Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Cron doesn't work
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo
View previous topic :: View next topic  
Author Message
TazG
Guru
Guru


Joined: 22 May 2004
Posts: 320
Location: Canada

PostPosted: Sat Sep 25, 2004 6:52 pm    Post subject: Cron doesn't work Reply with quote

I'm trying to use Cron. I have no experience with it. I have vixie-cron, and it is running. I tried to have it start Xine every 5 minutes as a test. I set it up with KCron.
Code:
crontab -l

# DO NOT EDIT THIS FILE - edit the master and reinstall.
# (/tmp/kde-taz/kcronvdbcSb.tmp installed on Sat Sep 25 15:18:41 2004)
# (Cron version -- $Id: crontab.c,v 2.13 1994/01/17 03:20:37 vixie Exp $)
# test
0,5,10,15,20,25,30,35,40,45,50,55 * * * *       /usr/bin/xine
# This file was written by KCron. Copyright (c) 1999, Gary Meyer
# Although KCron supports most crontab formats, use care when editing.
# Note: Lines beginning with "#\" indicates a disabled task.
What did I miss??
Back to top
View user's profile Send private message
inode77
Veteran
Veteran


Joined: 20 Jan 2004
Posts: 1303
Location: Heart of Europe

PostPosted: Sat Sep 25, 2004 7:12 pm    Post subject: Reply with quote

I suggest you type crontab -e in your shell. (It should open your default editor and allow you to edit the file including a sanity check after save&quit)
Code:
#       minute (0-59),
#       |       hour (0-23),
#       |       |       day of the month (1-31),
#       |       |       |       month of the year (1-12),
#       |       |       |       |       day of the week (0-6 with 0=Sunday).
#       |       |       |       |       |       commands
#       |       |       |       |       |       |
#       |       |       |       |       |       |
        0       10      *       *       *       /usr/bin/rdate -s swisstime.ee.ethz.ch &> /dev/null
#       |       |       |       |       |       |
        0       20      *       *       3       /usr/sbin/eupdatedb &> /dev/null
#       |       |       |       |       |       |
Back to top
View user's profile Send private message
TazG
Guru
Guru


Joined: 22 May 2004
Posts: 320
Location: Canada

PostPosted: Sat Sep 25, 2004 7:44 pm    Post subject: Reply with quote

It doesn't work with crontab -e either.
Back to top
View user's profile Send private message
inode77
Veteran
Veteran


Joined: 20 Jan 2004
Posts: 1303
Location: Heart of Europe

PostPosted: Sat Sep 25, 2004 8:24 pm    Post subject: Reply with quote

OK let's try some stuff....
1.) Make sure your cron runs
Code:
ps -ef | grep cron

should return a line like this:
Code:
root      6557     1  0 12:25 ?        00:00:00 /usr/sbin/cron

2.) Add this line to your cron using "crontab -e"
Code:
5,10,15,20,25,30,35,40,45,50,55       *      *       *       *       /usr/bin/logger "CRON_TEST" &> /dev/null

Check if the crontab has the line added after quiting with
Code:
crontab -l

3.) Wait some time and then check your /var/log/messages with
Code:
grep CRON_TEST /var/log/messages
and check the times when and if the messages do appear.
Back to top
View user's profile Send private message
TazG
Guru
Guru


Joined: 22 May 2004
Posts: 320
Location: Canada

PostPosted: Sun Sep 26, 2004 3:55 am    Post subject: Reply with quote

Well that did work - I got "CRON_TEST" in the log every 5 minutes. So, maybe it's only graphical programs that don't start? What if I wanted one to though, what can I do about this?
Back to top
View user's profile Send private message
hjnenc
Veteran
Veteran


Joined: 15 Aug 2004
Posts: 1599
Location: Vienna, Austria

PostPosted: Sun Sep 26, 2004 8:03 am    Post subject: Reply with quote

The cron jobs are run whenever the machine is running. It is not necessary that somebody is logged in nor that X is running. It is therefore probably not a good idea to try that. Depending on the program run and the person currently logged in it may also open up security holes.

If you really need to do that, make sure to set up the environment correctly for GUI programs (DISPLAY, XAUTHORITY, ...).
Back to top
View user's profile Send private message
zurd
Apprentice
Apprentice


Joined: 17 Dec 2003
Posts: 228
Location: Canada, Montreal

PostPosted: Thu Sep 30, 2004 7:01 am    Post subject: Easy stuff Reply with quote

Add this in your crontab :
DISPLAY=:0

Then you'll be able to run xine in crontab

Read
http://www.geocities.com/tipsforlinux/articles/23.html
for more info
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum