<font size="2"><font face="verdana,sans-serif">I'm attempting to have a bash script setup to run as a cronjob but it doesnt.<br><br>Here are the details:<br></font></font>*/2 * * * * /home/chris/scripts/crotate.sh<br><font size="2"><font face="verdana,sans-serif">This is the original bash script, I didn't write it but I like it.<br>
<br>#!/bin/bash<br><br>#<br># Rotates GNOME Wallpaper using pictures in $FOLDER<br>
# Run in background: ./rotate.sh &<br># Make sure there are no spaces in picture filenames<br># <a href="http://ubuntu.online02.com/node/37" target="_blank">http://ubuntu.online02.com/node/37</a><br>#<br><br>FOLDER="/home/chris/Pictures/Wallpapers/current" # Change to your directory<br>
cd $FOLDER<br><br>loop () {<br>NUMBER=$(ls -1 | wc -l)<br>RAN=$(($RANDOM%$NUMBER+1))<br>FILE=$(ls -1 | sed -n ${RAN}p)<br>echo $FILE<br>gconftool-2 --set "/desktop/gnome/background/picture_filename" --type string "$FOLDER/$FILE"<br>
sleep 90 # Time between change<br>loop<br>}<br>loop<br><br><br>-------------------<br><br>it works fine if you just run it or put it in screen and run it so you can detach and close out of it while it runs.<br>So I wanted to run this without having a screen or open terminal session going so I removed the loop notes and setup a cron job for it.<br>
<br><br>This is the modified script.<br><br>#!/bin/bash<br><br>FOLDER="/home/chris/Pictures/Wallpapers/current" # Change to your directory<br>cd $FOLDER<br><br>NUMBER=$(ls -1 | wc -l)<br>RAN=$(($RANDOM%$NUMBER+1))<br>
FILE=$(ls -1 | sed -n ${RAN}p)<br>echo $FILE >> /home/chris/scripts/wallpaper.log<br>/usr/bin/gconftool-2 --set "/desktop/gnome/background/picture_filename" --type string "$FOLDER/$FILE"<br><br>
<br>
It does write to my log file that i created. Just fine with the name of
the image that should be the desktop image but there is no change to the
desktop.<br><br><br># m h dom mon dow command<br>PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin<br>*/2 * * * * /home/chris/scripts/crotate.sh<div class="im"><br>------------------<br><br><br>Any help would be great.<br>
<br>Just calling the script ./crotate.sh and it works fine.<br><br>Thanks.<br><br><br>Chris<br></div><br></font></font>