dayoflayo
March 11th, 2007, 12:12 PM
Hello, so i've got a script that automatically change my wallpaper, and in this script, he launchs an other script that kill tilda and then relaunch it with differents options.
When i launch the script manually, no problem, but when it's crontab, i've got this problem :
after lauchning it manually :
dayoflayo@dayoflyo-laptop:~wallpapers$
after crontab :
$
here are my scripts :
#!/bin/bash
cd /home/dayoflayo/wallpaper
# nbr=$(find -name \[0-9]* |wc -l)
find . \( -name "*.jpg" -o -name "*.jpeg" -o -name "*.png" \) > list.tmp
sed -e 's/.\///g' list.tmp > list2.tmp
tab=list2.tmp
image=($(cat $tab))
nb=${#image }
toto=$((RANDOM% $nb))
file=${image[$toto]}
sudo mkdir /home/dayoflayo/num_wall
sudo chmod 777 /home/dayoflayo/num_wall
echo $file > /home/dayoflayo/nom_wall
chemin=$PWD/$file
gconftool-2 --type string --set /desktop/gnome/background/picture_filename "$chemin"
gconftool-2 --type string --set /desktop/gnome/background/picture_options centered
#echo $chemin
/home/dayoflayo/tilda.sh $file
#!/bin/bash
PID=`pidof -x tilda`
kill -15 $PID
sleep 5
if (test -n "$1")
then
case $1 in
0.png)
sleep 2
DISPLAY=:0.0 tilda -x 10 -y 700 &
;;
1.png)
sleep 2
DISPLAY=:0.0 tilda -x 10 -y 700 &
;;
2.jpg)
sleep 2
DISPLAY=:0.0 tilda -x 10 -y 700 &
;;
3.png)
sleep 2
DISPLAY=:0.0 tilda -x 10 -y 700 &
;;
4.jpg)
sleep 2
DISPLAY=:0.0 tilda -x 10 -y 700 &
;;
5.jpg)
sleep 2
DISPLAY=:0.0 tilda -x 10 -y 700 &
;;
6.jpg)
sleep 2
DISPLAY=:0.0 tilda -x 10 -y 700 &
;;
esac
else
wall=`sed -n 1p /home/dayoflayo/nom_wall`
case $wall in
0.png)
sleep 2
DISPLAY=:0.0 tilda -x 10 -y 700 &
;;
1.png)
sleep 2
DISPLAY=:0.0 tilda -x 10 -y 700 &
;;
2.jpg)
sleep 2
DISPLAY=:0.0 tilda -x 10 -y 700 &
;;
3.png)
sleep 2
DISPLAY=:0.0 tilda -x 10 -y 700 &
;;
4.jpg)
sleep 2
DISPLAY=:0.0 tilda -x 10 -y 700 &
;;
5.jpg)
sleep 2
DISPLAY=:0.0 tilda -x 10 -y 700 &
;;
6.jpg)
sleep 2
DISPLAY=:0.0 tilda -x 10 -y 700 &
;;
esac
fi
thx for your help
When i launch the script manually, no problem, but when it's crontab, i've got this problem :
after lauchning it manually :
dayoflayo@dayoflyo-laptop:~wallpapers$
after crontab :
$
here are my scripts :
#!/bin/bash
cd /home/dayoflayo/wallpaper
# nbr=$(find -name \[0-9]* |wc -l)
find . \( -name "*.jpg" -o -name "*.jpeg" -o -name "*.png" \) > list.tmp
sed -e 's/.\///g' list.tmp > list2.tmp
tab=list2.tmp
image=($(cat $tab))
nb=${#image }
toto=$((RANDOM% $nb))
file=${image[$toto]}
sudo mkdir /home/dayoflayo/num_wall
sudo chmod 777 /home/dayoflayo/num_wall
echo $file > /home/dayoflayo/nom_wall
chemin=$PWD/$file
gconftool-2 --type string --set /desktop/gnome/background/picture_filename "$chemin"
gconftool-2 --type string --set /desktop/gnome/background/picture_options centered
#echo $chemin
/home/dayoflayo/tilda.sh $file
#!/bin/bash
PID=`pidof -x tilda`
kill -15 $PID
sleep 5
if (test -n "$1")
then
case $1 in
0.png)
sleep 2
DISPLAY=:0.0 tilda -x 10 -y 700 &
;;
1.png)
sleep 2
DISPLAY=:0.0 tilda -x 10 -y 700 &
;;
2.jpg)
sleep 2
DISPLAY=:0.0 tilda -x 10 -y 700 &
;;
3.png)
sleep 2
DISPLAY=:0.0 tilda -x 10 -y 700 &
;;
4.jpg)
sleep 2
DISPLAY=:0.0 tilda -x 10 -y 700 &
;;
5.jpg)
sleep 2
DISPLAY=:0.0 tilda -x 10 -y 700 &
;;
6.jpg)
sleep 2
DISPLAY=:0.0 tilda -x 10 -y 700 &
;;
esac
else
wall=`sed -n 1p /home/dayoflayo/nom_wall`
case $wall in
0.png)
sleep 2
DISPLAY=:0.0 tilda -x 10 -y 700 &
;;
1.png)
sleep 2
DISPLAY=:0.0 tilda -x 10 -y 700 &
;;
2.jpg)
sleep 2
DISPLAY=:0.0 tilda -x 10 -y 700 &
;;
3.png)
sleep 2
DISPLAY=:0.0 tilda -x 10 -y 700 &
;;
4.jpg)
sleep 2
DISPLAY=:0.0 tilda -x 10 -y 700 &
;;
5.jpg)
sleep 2
DISPLAY=:0.0 tilda -x 10 -y 700 &
;;
6.jpg)
sleep 2
DISPLAY=:0.0 tilda -x 10 -y 700 &
;;
esac
fi
thx for your help