View previous topic :: View next topic |
Author |
Message |
badfrog n00b
Joined: 15 Jan 2009 Posts: 7
|
Posted: Thu Feb 05, 2009 2:22 am Post subject: trouble with vixie-cron jobs |
|
|
Hi all...
I have multiple vixie-cron jobs that don't appear to be running... I've executed multiple /etc/init.d/vixie-cron restarts since adding these jobs, and vixie-cron is running... In particular, I'm looking for results from the final 2 jobs defined below, a 10 minute shell script, and a file creation that's scheduled to happen each minute (for testing purposes). Neither of them are running, and as far as I can tell, none of the scheduled jobs appear to be running. I get no error messages that I can find (I have no /var/log/cron or any such file).
Code: |
resurrection tmp # crontab -l
# DO NOT EDIT THIS FILE - edit the master and reinstall.
# (/tmp/crontab.XXXX3MP2oC installed on Wed Feb 4 21:07:15 2009)
# (Cron version V5.0 -- $Id: crontab.c,v 1.12 2004/01/23 18:56:42 vixie Exp $)
# for vixie cron
#
# $Header: /var/cvsroot/gentoo-x86/sys-process/vixie-cron/files/crontab-3.0.1-r4,v 1.1 200
5/03/04 23:59:48 ciaranm Exp $
#
#
# Global variables
SHELL=/bin/bash
PATH=/sbin:/bin:/usr/sbin:/usr/bin
MAILTO=root
HOME=/
# check scripts in cron.hourly, cron.daily, cron.weekly and cron.monthly
0 * * * * root rm -f /var/spool/cron/lastrun/cron.hourly
1 3 * * * root rm -f /var/spool/cron/lastrun/cron.daily
15 4 * * 6 root rm -f /var/spool/cron/lastrun/cron.weekly
30 5 1 * * root rm -f /var/spool/cron/lastrun/cron.monthly
*/10 * * * * root test -x /usr/sbin/run-crons && /usr/sbin/run-crons
0 2 * * * root /usr/local/sbin/flexget/flexget.py
0 * * * * root /bin/sh /etc/logcheck/logcheck.sh
0 * * * * root chown -R nobody:nobody /home/media
0 * * * * root chown -R nobody:nobody /home/media2
0 * * * * root chown -R nobody:nobody /home/music
*/10 * * * * root /home/rtorrent/torrentQueueManager.sh
* * * * * root echo "1" /home/lamont/test.txt
#EOF - you need a blank line after last job or it won't be read.
resurrection tmp # /etc/init.d/vixie-cron restart
* Stopping vixie-cron ... [ ok ]
* Starting vixie-cron ... [ ok ]
resurrection tmp # date
Wed Feb 4 21:03:32 EST 2009
resurrection tmp # date
Wed Feb 4 21:14:50 EST 2009
resurrection tmp # tail /var/log/messages
Feb 4 21:10:01 resurrection cron[5615]: (root) CMD (test -x /usr/sbin/run-crons && /usr/s
bin/run-crons )
Feb 4 21:10:01 resurrection cron[5619]: (root) CMD (root^Iecho "1" /home/lamont/test.txt)
Feb 4 21:10:01 resurrection cron[5624]: (root) CMD (root^I/home/rtorrent/torrentQueueMana
ger.sh)
Feb 4 21:10:01 resurrection cron[5627]: (root) CMD (root^Itest -x /usr/sbin/run-crons &&
/usr/sbin/run-crons )
Feb 4 21:11:01 resurrection cron[5649]: (root) CMD (root^Iecho "1" /home/lamont/test.txt)
Feb 4 21:12:01 resurrection cron[5654]: (root) CMD (root^Iecho "1" /home/lamont/test.txt)
Feb 4 21:12:32 resurrection crontab[5659]: (root) LIST (root)
Feb 4 21:13:01 resurrection cron[5661]: (root) CMD (root^Iecho "1" /home/lamont/test.txt)
Feb 4 21:14:01 resurrection cron[5667]: (root) CMD (root^Iecho "1" /home/lamont/test.txt)
resurrection tmp # ls /home/lamont/test.txt
ls: cannot access /home/lamont/test.txt: No such file or directory
resurrection tmp # ls /var/log/torrentQueueManager.log
ls: cannot access /var/log/torrentQueueManager.log: No such file or directory
resurrection tmp # /home/rtorrent/torrentQueueManager.sh
resurrection tmp # tail /var/log/torrentQueueManager.log
Checking queue directories
Watch queue '/home/rtorrent/watch' contains 1 items.
Work queue '/home/rtorrent/work' contains 1 items. Max capacity is 5
Found 1 items that can be moved.
Moving test4.txt...
resurrection tmp # mail
No mail for root
|
The only odd thing I see is that my jobs appear to have "root ^I" in the log file. I assume that's messing something up? Sooo... help? What the hell am I doing wrong?
Thanks. |
|
Back to top |
|
|
doctork Guru
Joined: 25 Apr 2004 Posts: 370 Location: Cleveland, OH
|
Posted: Thu Feb 05, 2009 2:42 am Post subject: |
|
|
Quote: | The only odd thing I see is that my jobs appear to have "root ^I" in the log file. I assume that's messing something up? Sooo... help? What the hell am I doing wrong? |
I'd guess the "root^I" is there because that's what you have in the crontab -- just like "crontab -l" says.
doc |
|
Back to top |
|
|
neysx Retired Dev
Joined: 27 Jan 2003 Posts: 795
|
Posted: Thu Feb 05, 2009 6:53 am Post subject: |
|
|
Wrong command: you ran crontab /etc/crontab and you shouldn't have.
Wrong syntax: username should only appear in system crontab file, not in user's crontabs
man 5 crontab and man 1 crontab |
|
Back to top |
|
|
ppurka Advocate
Joined: 26 Dec 2004 Posts: 3256
|
Posted: Thu Feb 05, 2009 2:07 pm Post subject: |
|
|
Quote: | * * * * * root echo "1" /home/lamont/test.txt | Command is incorrect. You want Code: | echo "1" > /home/lamont/test.txt |
_________________ emerge --quiet redefined | E17 vids: I, II | Now using kde5 | e is unstable :-/ |
|
Back to top |
|
|
badfrog n00b
Joined: 15 Jan 2009 Posts: 7
|
Posted: Thu Feb 05, 2009 2:22 pm Post subject: |
|
|
neysx wrote: | Wrong command: you ran crontab /etc/crontab and you shouldn't have. |
Actually, no. I've been running the command shown below for vixie-cron: crontab -e
http://www.gentoo.org/doc/en/cron-guide.xml#scheduling
ppurka wrote: | Command is incorrect. You want |
doctork wrote: |
I'd guess the "root^I" is there because that's what you have in the crontab -- just like "crontab -l" says.
|
Exactly. Why is that ignored for the other jobs then? |
|
Back to top |
|
|
neysx Retired Dev
Joined: 27 Jan 2003 Posts: 795
|
Posted: Thu Feb 05, 2009 4:48 pm Post subject: |
|
|
badfrog wrote: | neysx wrote: | Wrong command: you ran crontab /etc/crontab and you shouldn't have. |
Actually, no. I've been running the command shown below for vixie-cron: crontab -e | Actually yes. crontab -e proves you did it wrong. Read better. |
|
Back to top |
|
|
badfrog n00b
Joined: 15 Jan 2009 Posts: 7
|
Posted: Thu Feb 05, 2009 5:40 pm Post subject: |
|
|
neysx wrote: | badfrog wrote: | neysx wrote: | Wrong command: you ran crontab /etc/crontab and you shouldn't have. |
Actually, no. I've been running the command shown below for vixie-cron: crontab -e | Actually yes. crontab -e proves you did it wrong. Read better. |
I read just fine. Write better howto's I suppose.
Gee. Thanks for the help /sarcasm. |
|
Back to top |
|
|
coolsnowmen Veteran
Joined: 30 Jun 2004 Posts: 1479 Location: No.VA
|
Posted: Thu Feb 05, 2009 10:42 pm Post subject: |
|
|
Quote: | Code Listing 3.16: Editing a crontab in place
# crontab -e
|
neysx wrote: |
Actually yes. crontab -e proves you did it wrong. Read better.
|
The how-to says to use crontab -e to edit the cron file.
badfrog says that is what he used.
You called him illiterate.
What is he missing? _________________ emerge: there are no ebuilds to satisfy "moo" |
|
Back to top |
|
|
username234 Guru
Joined: 09 May 2007 Posts: 332
|
Posted: Fri Feb 06, 2009 12:17 am Post subject: |
|
|
^I is the the horizontal tab character.
Also read the following, it does a better job explaining Vixie Cron:
http://www.unixgeeks.org/security/newbie/unix/cron-1.html _________________ Creating usernames when you're
in a creative slump is a bad idea
because if you are when you do
then you end up with uninspiring
alphanumeric cocktails like the
one directly above. |
|
Back to top |
|
|
neysx Retired Dev
Joined: 27 Jan 2003 Posts: 795
|
Posted: Fri Feb 06, 2009 6:56 am Post subject: |
|
|
coolsnowmen wrote: | Quote: | Code Listing 3.16: Editing a crontab in place
# crontab -e
|
neysx wrote: |
Actually yes. crontab -e proves you did it wrong. Read better.
|
The how-to says to use crontab -e to edit the cron file.
badfrog says that is what he used.
You called him illiterate.
What is he missing? | Where did I write using crontab -e was wrong? Nowhere. Read again.
badfrog ran crontab /etc/crontab, his own post proves it, I told him he shouldn't have, but he'd rather deny it...
Besides, his root's crontab uses a wrong format, one field too many (username before command) and as a result none of the commands in his root's crontab are run. Did you notice? none
On the other hand, the commands in the system crontab (/etc/crontab) are run.
Again, man 5 crontab and man 1 crontab |
|
Back to top |
|
|
badfrog n00b
Joined: 15 Jan 2009 Posts: 7
|
Posted: Wed Feb 11, 2009 3:14 am Post subject: |
|
|
Not sure I like what I'm seeing about how things operate here...
neysx wrote: | Where did I write using crontab -e was wrong? Nowhere. Read again.
|
You sure as hell implied it. Twice now:
Quote: |
badfrog ran crontab /etc/crontab, his own post proves it,
|
"It" appearing to be that contab -e is somehow wrong. But do you actually offer any advice on what the correct command would be, since apparently the how-to is wrong? Why no!
Quote: |
I told him he shouldn't have, but he'd rather deny it...
|
lol I'm denying it because I didn't run crontab /etc/contab like I said 3 times now. Berating people who follow Gentoo docs as illiterate does nothing to help anyone, and is actually quite funny since having a functioning Gentoo install in the first damn place requires a fair bit of reading
Quote: | Besides, his root's crontab uses a wrong format, one field too many (username before command) and as a result none of the commands in his root's crontab are run. Did you notice? none |
I noticed. And I asked why. Got no really helpful response from you, neysx, just what appears to be your typical UR DOIN IT RONG! yelling. If that's all you had to contribute, one wonders why you bothered to respond at all. Or is it just that you just get off on trolling people with ad hominems and otherwise being an ass to new people?
Thanks for perpetuating the "RTFM N00B" linux help stereotype. GG repping the community! |
|
Back to top |
|
|
Hu Moderator
Joined: 06 Mar 2007 Posts: 21607
|
Posted: Wed Feb 11, 2009 3:31 am Post subject: |
|
|
badfrog: you have your solution. What did you run to get an incorrect crontab in the first place? The howto looks fine to me, though I have not followed it to confirm. |
|
Back to top |
|
|
timeBandit Bodhisattva
Joined: 31 Dec 2004 Posts: 2719 Location: here, there or in transit
|
Posted: Wed Feb 11, 2009 5:53 am Post subject: |
|
|
Moved from Portage & Programming to Other Things Gentoo.
badfrog wrote: | Got no really helpful response from you, neysx, just what appears to be your typical UR DOIN IT RONG! yelling. If that's all you had to contribute, one wonders why you bothered to respond at all. Or is it just that you just get off on trolling people with ad hominems and otherwise being an ass to new people? | While neysx's tone and quality of help was marginal, that is insufficient cause for a borderline personal attack. badfrog, consider this your warning to read and adhere to the Forum Guidelines (viz. #10).
Now, on the subject of crontabs, there is a subtle point that some people do miss at first:- /etc/crontab is the system crontab. It belongs to no user and can run jobs as any user. This is the only crontab that accepts a user name in field six, to specify the effective ID for each spawned job. You do not edit this crontab with the crontab command--use an ordinary editor such as nano or vi.
- crontab -e edits the current user's crontab (stored in /var/spool/cron/crontabs/). N.B.: root's crontab and the system crontab are not the same. User crontabs--including root's--never specify a username in field six. All jobs are run by the user ID that owns the crontab.
Per-user crontabs are most useful in multi-user systems whose administrators don't want to be pestered every time a user needs to change cron jobs. User crontabs are independent of the system crontab. Thus if root has a crontab, jobs therein run in addition to those in the system crontab.
In a typical desktop system, it's easier to create job scripts in /etc/cron.{hourly,daily,weekly,monthly}/ when those intervals are sufficient. When they are not, either edit /etc/crontab or run crontab -e as root to define jobs at other intervals. Don't do both. It's not wrong per se, it's just confusing.
The fact that crontab -l produces any output other than this: Code: | # crontab -l
no crontab for root | indicates that you ran crontab -e or crontab /etc/crontab as root. This was the basis for neysx's comments. To fix it, run crontab -r to delete root's crontab file--the one you have now duplicates jobs from the system crontab. Then, re-define your additional jobs as described above.
One last note: these four jobs run on the hour: Code: | 0 * * * * root /bin/sh /etc/logcheck/logcheck.sh
0 * * * * root chown -R nobody:nobody /home/media
0 * * * * root chown -R nobody:nobody /home/media2
0 * * * * root chown -R nobody:nobody /home/music | You should put the commands in a file in /etc/cron.hourly/ rather than schedule new jobs. With some bash cleverness, you can handle your only-at-2:00am job in the same script. _________________ Plants are pithy, brooks tend to babble--I'm content to lie between them.
Super-short f.g.o checklist: Search first, strip comments, mark solved, help others. |
|
Back to top |
|
|
vose n00b
Joined: 28 Feb 2007 Posts: 33
|
Posted: Sat Aug 16, 2014 2:25 pm Post subject: crontab -l |
|
|
Thanks timeBandit.
Like badfrog, I too was hving trouble with cron... your post Wed Feb 11, 2009 12:53 am sorted it all out.
I'ld bet the farm that I NEVER ran crontab -e or crontab /etc/crontab as root on my new install.
Hovever, crontab -l shows a crontab file for root!
Deleting the duplicate was what I needed.
Thanks again. |
|
Back to top |
|
|
|