Programming and Scripting :: problem with xplanet scripts



These litle scripts i made to change my background (X). I call them with a keymapping (for instance ALT-1, ALT-2, etc..) whenever i feel like a different background. Generally what happens is: i fire up xplanet to show Europe with clouds or America with clouds or the moon with constellations.

Here are the 3 scripts:

#!/bin/bash
myvar=0
sudo killall -9 xplanethur &
sudo killall -9 xplanetmoon &
until [ $myvar -eq -1]
do
wget -c http://xplanet.dyndns.org.nyud.net:8090/clouds/clouds_2048.jpg &
xplanet -num_times 1 -longitude 5 -latitude 51 -date `date +%G%m%d.%H%M%S` -range 100 -radius 100 &
sleep 6000
rm ~/clouds*.*
myvar=$(( $myvar + 1 ))
done

#!/bin/bash
myvar=0
sudo killall -9 xplanetearth &
sudo killall -9 xplanetmoon &
until [ $myvar -eq -1]
do
wget -c http://xplanet.dyndns.org.nyud.net:8090/clouds/clouds_2048.jpg
xplanet -num_times 1 -long -89.29 -lat 26.32 -date `date +%G%m%d.%H%M%S` -radius 148 -label -marker_file=/home/dsl/.xplanet/markers/earth &
sleep 6000
rm ~/clouds*.*
myvar=$(( $myvar + 1 ))
done

#!/bin/bash
killall -9 xplanetearth &
killall -9 xplanethur &
rm ~/clouds*.jpg &
xplanet -rotate 350 -marker_file constellations -gmtlabel -arc_file constellations -longitude 5 -latitude 51 -date `date +%G%m%d.%H%M%S` -body moon -radius 10 -range 10 -origin earth

The work fine but sometimes when i have been switching backgrounds a lot i suddenly (without requesting it) get an other background from an other script.


I want to know what i am doing wrong. I look a lot with "top" at the processes that remain active whenever i killall the scripts that should end and notice a lot of "sleep 6000" remaining active (untill the die by them self, the can't be killed)


???

I changed some in my scripts and now it seems to be working better! (strange how everything becomes much clearer when you write it down)

changed scripts:

#!/bin/bash
myvar=0
until [ $myvar -eq -1]
do
sudo killall -9 xplanet
sudo killall -9 xplanet
sudo killall -9 xplanethur
sudo killall -9 xplanetmoon
sudo killall -9 sleep
sudo killall -9 sleep
sudo wget http://giga.forfun.net/clouds_2048.jpg
sudo wget http://www.wizabit.eclipse.co.uk/xplanet/files/local/storm
sudo cp /home/dsl/storm /home/dsl/.xplanet/markers
xplanet -num_times 1 -longitude 5 -latitude 51 -date `date +%G%m%d.%H%M%S` -range 100 -radius 100 -marker_file=/home/dsl/.xplanet/markers/storm &
sleep 6000
myvar=$(( $myvar + 1 ))
done

#!/bin/bash
myvar=0
until [ $myvar -eq -1]
do
sudo killall -9 xplanet
sudo killall -9 xplanet
sudo killall -9 xplanetearth
sudo killall -9 xplanetmoon
sudo killall -9 sleep
sudo killall -9 sleep
sudo wget http://giga.forfun.net/clouds_2048.jpg
sudo wget http://www.wizabit.eclipse.co.uk/xplanet/files/local/storm
sudo cp /home/dsl/storm /home/dsl/.xplanet/markers
xplanet -num_times 1 -long -89.29 -lat 26.32 -date `date +%G%m%d.%H%M%S` -radius 148 -label -marker_file=/home/dsl/.xplanet/markers/earth -marker_file=/home/dsl/.xplanet/markers/storm &
sleep 6000
myvar=$(( $myvar + 1 ))
done

#!/bin/bash
sido killall -9 xplanet
sudo killall -9 xplanetearth
sudo killall -9 xplanethur
sudo killall -9 sleep
sudo killall -9 sleep
sudo rm /home/dsl/clouds_2048.jpg
xplanet -rotate 350 -marker_file constellations -gmtlabel -arc_file constellations -longitude 5 -latitude 51 -date `date +%G%m%d.%H%M%S` -body moon -radius 10 -range 10 -origin earth



bit overkill with all the killall sleep commands but better save than sorry..

(works great so far, added an extra marker for huricane info on screen)


original here.