I have written a shell script which downloads random wallpaper from a web-page and sets it as a background every 5 hours. Here is the script:
#!/bin/bash countervar=1; finish=0; cd /home/guinness/.rwallpaper/ if [ -f counter ] then countervar=`cat counter` fi for (( i=$countervar; c<=2000000; i++ )) do echo $i > "counter" if [ ! -f wallpaper-$i.jpg ] then wget "http://wallpapers.wallbase.cc/rozne/wallpaper-$i.jpg" if [ -f wallpaper-$i.jpg ] then gsettings set org.gnome.desktop.background picture-uri "file:///home/guinness/.rwallpaper/wallpaper-$i.jpg" exit fi fi done
If I run a this script it works like a charm. I use cron to run this every 5 hours. The problem, is that it runs every 5 hours and successfully downloads the next image but it doesn't set it as a wallpaper. Can anybody tell me what can be the problem?