HD Install :: How to use Cron ?



Hi Folks,

my system - dsl 3.2 frugal

need some help with running cron.
i edited the /etc/crontab file and
added the following

0 10 * * * * /home/dsl/xx.sh

then i ran the MyCron from system -> control panel.
at 10 am the scheduled script didnt run.

what i am i missing ? is there a specific cron howto for dsl ?

thanks.

manishsadh, you can have cron output to a file, including errors, to view. To do this use the following line in your crontab:
Code Sample
0 10 * * * * /home/dsl/xx.sh >> /path/to/output/file 2>&1

I am having trouble with cron also. It runs, but will not open gui applications. When I use the following line in the crontab:
Code Sample
* * * * * * beaver & >> /tmp/crontest 2>&1

The application does not open and I get this in nohup.out:
Quote
Gtk-WARNING **: cannot open display:

I get similar results for all gui applications that I try to open with cron. All the applications do run when I use Aterm or click on an icon.

Though they will run if I use the following line in crontab instead:
Code Sample
* * * * * * xterm -e beaver & >> /tmp/crontest 2>&1

but then I have an extra xterm window open that I don't want.

I'm not sure if this is a problem with gtk or with cron.

I also tryed using cron to start a script that would call a gui program and I got the same results. the script would run, but the application I wanted to start did not.

Does anyone know of a fix for this or have any guidance for this situation?

Thanks
Rob

I was having the same problem.

I had a shell script that used xset to turn the screen off.  I had to launch the script with /bin/bash instead of sh and I had to add "export DISPLAY=:0" to the beginning of my shell script.

In your case you may want to create a script such as this...
Code Sample
#!bin/bash
export DISPLAY=:0
beaver &


I hope that helps!
-James

jimmit,

I added the export line to my script and now it works with cron.  :)

Thank you for the tip.


Rob


original here.