LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   Cron Scheduling isn't working for me, can someone walk me through this? (https://www.linuxquestions.org/questions/linux-software-2/cron-scheduling-isnt-working-for-me-can-someone-walk-me-through-this-577129/)

gohmifune 08-14-2007 06:24 PM

Cron Scheduling isn't working for me, can someone walk me through this?
 
I have tried this on Ubuntu, now I'm in Fedora, and it isn' working. This is a very needed feature. Can someone go through the automated launching of liferea, evolution, and firefox everyday at 1145pm? I think I need the exact commands to type in terminal or put in gnome-schedule. Online tutorials aren't helping me fix this.

First I think in need to know in Fedora how to make sure crond is launching.

thebouv 08-14-2007 06:55 PM

Edit your personl crontab do this:

Code:

crontab -e
Then you'll add these lines:

Code:

45 23 * * * /path/to/evolution
45 23 * * * /path/to/firefox
45 23 * * * /path/to/anythingelse

The reason it might not have worked using your crontab file or gnome-schedule is that you were perhaps not using military time?

Handy diagram btw:

Code:

# Use the hash sign to prefix a comment
# +---------------- minute (0 - 59)
# |  +------------- hour (0 - 23)
# |  |  +---------- day of month (1 - 31)
# |  |  |  +------- month (1 - 12)
# |  |  |  |  +---- day of week (0 - 7) (Sunday=0 or 7)
# |  |  |  |  |
# *  *  *  *  *  command to be executed


gohmifune 08-15-2007 01:33 AM

Thank you very much for the response. I tried launching liferea with

25 01 * * * /usr/bin/liferea

nothing happened. That should be the correct format, Did it early enough so that the daemon would catch it, but nothing. The daemon should start, but is there a way to make sure it is running, or anything else I should look for?

thebouv 08-15-2007 10:38 AM

Check your cron log: /var/log/cron.log

Though, since you asked how to make sure cron is even running:

ps ax | grep cron

Should see a line that says: /usr/sbin/cron

colucix 08-16-2007 07:50 PM

It is a problem about the execution of X applications from crontab: in the cron environment the DISPLAY variable is not defined, so when you launch a X application you will likely get the error "cannot connect to X server". A way to solve this is to launch your application with the env command, like:
Code:

25 01 * * * env DISPLAY=:0 /usr/bin/liferea
assuming you want to launch liferea by connecting to display :0 and assuming you have the proper permissions. You can check the environment variable $DISPLAY and set the display number accordingly.

gilead 08-16-2007 08:12 PM

colucix is right about setting the DISPLAY variable - here are a couple of examples I use here for changing the background image when I'm connected locally (display :0.0) or via VNC (display :1.0):
Code:

0-59 * * * * (DISPLAY=:0.0 /usr/X11R6/bin/fbsetbg -r /home/steve/.fluxbox/backgrounds 2>/dev/null)
0-59 * * * * (DISPLAY=:1.0 /usr/X11R6/bin/fbsetbg -r /home/steve/.fluxbox/backgrounds 2>/dev/null)



All times are GMT -5. The time now is 03:10 PM.