DCOP calls and cron

Tez binary_y2k2 at blueyonder.co.uk
Sun Feb 18 16:17:34 UTC 2007


Thomas Olsen wrote:
> I have made a small script - basically a one-liner - to fetch the daily 
> Doonesbury strip and set it as my desktop background.
> When I run it from the cli it works ok but when it is run from a cron job it 
> doesn't change the background.
>
> I'm guessing the dcop call fails for some reason...?
>
> It could all be in one line but I separted it a bit for debugging. (The third 
> line starting with REMOTE shouldn't kine-break)
>
> - ----[snip]------------------------------------------------------
> #!/bin/bash
> cd $HOME/
> REMOTE="http://images.ucomics.com/comics/db/`date +'%Y'`/db`date 
> +'%y%m%d'`.gif"
> LOCAL=$HOME/Doonesbury/db`date +'%y%m%d'`.gif
> echo `pwd` > /home/tol/Doonesbury.log
> echo $REMOTE >> /home/tol/Doonesbury.log
> echo $LOCAL >> /home/tol/Doonesbury.log
> wget $REMOTE
> sleep 5
> dcop kdesktop KBackgroundIface setWallpaper 2 $LOCAL 1
> - ----[snip]------------------------------------------------------
>
> - -- 
> Med venlig hilsen / Best regards
> 	Thomas Olsen
>
>
>
>   
Because the script is run as root (default for cron) it would be trying 
to connect to roots dcop server, not your users.
So 1st change "cd $HOME/Doonesbury" to "cd /home/tol/Doonesbury"
or "cd ~tol/Doonesbury" then change the dcop line to:
"dcop --user tol kdesktop KBackgroundIface setWallpaper 2 $LOCAL 1"

Give that a go

Tez








More information about the kubuntu-users mailing list