cron doesn't run commands in /etc/crontab?
According to cron(8), cron should be able to read commands from a properly formatted and chmoded /etc/crontab file. I've created such a file, but I can't seem to get cron to run the test command in it. # cat EOF /etc/crontab */1 * * * * /usr/bin/touch /tmp/crontest EOF # chmod 0600 /etc/crontab cron then successfully loads the changes made to that file: Mar 28 07:23:01 lass cron[11652]: (*system*) RELOAD (/etc/crontab) I can also verify that the system file is loaded by watching the output of `cron -x load`. The command is valid per crontab(5) and works when inserted in root's tab using `crontab -e`. After the system tab is reloaded, cron fails to run any commands listed there: no CMD messages are logged (or seen in the debugging output) and the file is never touched. I've tried to get this to work on a semi-recent -current/i386 as well as the latest snapshot (also i386) with no luck. I browsed the code, but didn't see any obvious problems. Any ideas? -- o--{ Will Maier }--o | web:...http://www.lfod.us/ | [EMAIL PROTECTED] | *--[ BSD Unix: Live Free or Die ]--*
Re: cron doesn't run commands in /etc/crontab?
On Wed, Mar 28, 2007 at 08:41:34AM -0500, Will Maier wrote: | According to cron(8), cron should be able to read commands from a | properly formatted and chmoded /etc/crontab file. I've created such | a file, but I can't seem to get cron to run the test command in it. | | # cat EOF /etc/crontab | */1 * * * * /usr/bin/touch /tmp/crontest | EOF | # chmod 0600 /etc/crontab | | cron then successfully loads the changes made to that file: | | Mar 28 07:23:01 lass cron[11652]: (*system*) RELOAD (/etc/crontab) | | I can also verify that the system file is loaded by watching the | output of `cron -x load`. The command is valid per crontab(5) and | works when inserted in root's tab using `crontab -e`. | | After the system tab is reloaded, cron fails to run any commands | listed there: no CMD messages are logged (or seen in the debugging | output) and the file is never touched. | | I've tried to get this to work on a semi-recent -current/i386 as | well as the latest snapshot (also i386) with no luck. I browsed the | code, but didn't see any obvious problems. Reread crontab(5), the /etc/crontab has a slightly different format (to specify username). Cheers, Paul 'WEiRD' de Weerd -- [++-]+++.+++[---].+++[+ +++-].++[-]+.--.[-] http://www.weirdnet.nl/
Re: cron doesn't run commands in /etc/crontab?
On 2007/03/28 08:41, Will Maier wrote: According to cron(8), cron should be able to read commands from a properly formatted and chmoded /etc/crontab file. I've created such a file, but I can't seem to get cron to run the test command in it. # cat EOF /etc/crontab */1 * * * * /usr/bin/touch /tmp/crontest The system crontab (/etc/crontab) has an addition user field before command, see crontab(5).
Re: cron doesn't run commands in /etc/crontab?
On Wed, 28 Mar 2007, Will Maier wrote: According to cron(8), cron should be able to read commands from a properly formatted and chmoded /etc/crontab file. I've created such a file, but I can't seem to get cron to run the test command in it. # cat EOF /etc/crontab */1 * * * * /usr/bin/touch /tmp/crontest EOF # chmod 0600 /etc/crontab cron then successfully loads the changes made to that file: Mar 28 07:23:01 lass cron[11652]: (*system*) RELOAD (/etc/crontab) I can also verify that the system file is loaded by watching the output of `cron -x load`. The command is valid per crontab(5) and works when inserted in root's tab using `crontab -e`. No, the system crontab (/etc/crontab) file needs an extra field, as described in the manual. -Otto
Re: cron doesn't run commands in /etc/crontab?
Feel free to laugh if this is a stupid question, but have you made sure to leave an extra empty line at the end of the crontab? Are you in /var/cron/cron.allow ? Also, I usually pack everything into a script and then have cron call the script. It makes verbose comments and multi-line commands less obtrusive. -Lars Lars NoodC)n ([EMAIL PROTECTED]) Ensure access to your data now and in the future http://opendocumentfellowship.org/about_us/contribute On Wed, 28 Mar 2007, Will Maier wrote: According to cron(8), cron should be able to read commands from a properly formatted and chmoded /etc/crontab file. I've created such a file, but I can't seem to get cron to run the test command in it. # cat EOF /etc/crontab */1 * * * * /usr/bin/touch /tmp/crontest EOF # chmod 0600 /etc/crontab cron then successfully loads the changes made to that file: Mar 28 07:23:01 lass cron[11652]: (*system*) RELOAD (/etc/crontab) I can also verify that the system file is loaded by watching the output of `cron -x load`. The command is valid per crontab(5) and works when inserted in root's tab using `crontab -e`. After the system tab is reloaded, cron fails to run any commands listed there: no CMD messages are logged (or seen in the debugging output) and the file is never touched. I've tried to get this to work on a semi-recent -current/i386 as well as the latest snapshot (also i386) with no luck. I browsed the code, but didn't see any obvious problems. Any ideas?
Re: cron doesn't run commands in /etc/crontab?
On Wed, Mar 28, 2007 at 03:58:35PM +0200, Paul de Weerd wrote: Reread crontab(5), the /etc/crontab has a slightly different format (to specify username). Oh. ;) Quite right -- thanks for the cluestick. -- o--{ Will Maier }--o | web:...http://www.lfod.us/ | [EMAIL PROTECTED] | *--[ BSD Unix: Live Free or Die ]--*
Re: cron doesn't run commands in /etc/crontab?
On 28 Mar 2007 at 8:41, Will Maier wrote: According to cron(8), cron should be able to read commands from a properly formatted and chmoded /etc/crontab file. I've created such a file, but I can't seem to get cron to run the test command in it. # cat EOF /etc/crontab */1 * * * * /usr/bin/touch /tmp/crontest That ain't a properly formatted system crontab string (you're missing the user field) It is however a vaild user crontab string but then you can't put it in the system crontab.