Live on television !

Live on television !

Being a happy Ubuntu user for a while, I installed XBMC on my HTPC. As this machine is also used as a desktop (it’s in the living room) I wanted a script to launch Ubuntu and place it on the TV that is connected trough HDMI. After trying a bunch of scripts I found on the internet none of them really worked the way I wanted. For starters, Gnome only gives me one desktop to play around with. This script does the following:
Off course you will need to change a few parameters to make it work for your case. Your TV might not be connected to HDMI1 and may have a different size for example.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 | #! /bin/bash if $(xrandr --prop |grep -q "HDMI1 connected") then echo "Disable Power Manager" gconftool-2 --set --type integer "/apps/gnome-power-manager/timeout/sleep_computer_ac" 0 echo "Activate HDMI1" xrandr --output HDMI1 --left-of HDMI2 --mode 1920x1080 xrandr --output HDMI2 --auto --primary echo "Start XBMC in background" killall -s9 -q xbmc.bin xbmc & echo "Wait for the XBMC window to appear" status=0 while [ $status -eq 0 ] do sleep 1 status=`wmctrl -x -l | grep "XBMC Media Center" | wc -l | awk '{print $1}'` done echo "Move XBMC to secondary screen" wmctrl -x -r XBMC Media Center.XBMC Media Center -e 0,0,0,800,600 sleep 1 echo "Force XBMC window to fullscreen" wmctrl -x -r XBMC Media Center.XBMC Media Center -b toggle,fullscreen # Wait for the XBMC window to disappear status=1 while [ $status -eq 1 ] do sleep 1 status=`wmctrl -x -l | grep "XBMC Media Center" | wc -l | awk '{print $1}'` done echo "Disable HDMI1" xrandr --output HDMI1 --off echo "Wait 2 seconds for xrandr to complete" sleep 2 echo "Enable Power Manager (Sleep / 30 Minutes)" gconftool-2 --set --type integer "/apps/gnome-power-manager/timeout/sleep_computer_ac" 1800 else echo -e "HDMI1 is not connected" fi |
There you go. If you have any suggestions or need help getting this to work on your end feel free to leave a comment!
I’m working on a script that cleans up the users home directory. It currently:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 | ##################################### # How2 Solutions - http://how2.be # cPanel Cleanup Script # version 1.0 ##################################### for user in `ls -A /var/cpanel/users` do echo $user ##################################### # archive error_log ##################################### rm -f /home/$user/error_log.tar rm -f /home/$user/error_log.tar.gz FILE_LIST=`find /home/$user/public_html -type f -name "error_log"` for error_log_file in $FILE_LIST do echo $error_log_file tar -rf /home/$user/error_log.tar $error_log_file rm -f $error_log_file done gzip -f /home/$user/error_log.tar chown root:$user /home/$user/error_log.tar.gz ##################################### # remove cpmove.psql ##################################### rm -rf /home/$user/cpmove.psql* done |
I’m planning to custimize this a bit more so error_log files are archived once a month and offer users the ability to disable archiving. More cleanup actions will be added as well. If you think of something usefull to add to this script let me know!
I recently switched out my main router for the Dual WAN Draytek Vigor 2920. While setting everything up, I had some trouble getting Wake On Lan to work as I would like.
Sure, the router offers the ability to logon to the Administration Console remotely or trough telnet and wake up a machine from there. But I am spoiled these days and used to waking my computer wit the press of a button. I actually use Wake On Lan for Android to wake my machine while walking up the stairs or from work. I use my Dynamic DNS as a host name.
This is the configuration I finally ended up with. It works both from the internet and the local network.
1. Under “Lan” > “Bind IP to MAC” define a new entry for IP “192.168.0.254″ with MAC FF:FF:FF:FF:FF
2. Under “NAT” > “Open Ports” you will need to set the following. I added an entry for both my WAN interfaces.
Not the obvoius choice but at least it works
If you are having problems with the font size in ISP Monitor (or other software) being too large, please read this article.
This is some weird Microsft bug imho
Armageddon or Independence Day: Day One and V have it all!