From mboxrd@z Thu Jan 1 00:00:00 1970 From: Andrew Kelly Subject: Re: Cronjobs Date: Wed, 30 Jul 2003 12:16:52 +0200 Sender: linux-admin-owner@vger.kernel.org Message-ID: <3F279B14.3FDC2756@transparency.org> References: <20030730080516.GZ26455@gx.nl> Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Return-path: List-Id: Content-Type: text/plain; charset="us-ascii" To: linux-admin@vger.kernel.org Stefan Wimmer wrote: > > * Tom Troonbeeckx wrote on 30/Jul/2003 - 09:34:38 : > > Dear Sir/Madam, > > > > I have some proplem with mine cronjobs. > > > > I edit mine /etc/crontab with the following command "crontab -e". > > The crontab looks like this > > > > SHELL=/bin/bash > > PATH=/sbin:/bin:/usr/sbin:/usr/bin > > MAILTO=root > > HOME=/ > > > > # run-parts > > 01 * * * * root run-parts /etc/cron.hourly > > 01 0 * * * root run-parts /etc/cron.daily > > 30 14 * * * root run-parts /etc/cron.twice.a.day > > 30 18 * * * root run-parts /etc/cron.twice.a.day > > 22 4 * * 0 root run-parts /etc/cron.weekly > > 42 4 1 * * root run-parts /etc/cron.monthly > > 3,18,33,48 * * * * root run-parts /etc/cron.quarter-hourly > > 1,6,11,16,21,26,31,36,41,46,51,56 * * * * root run-parts /etc/cron.5-min > > > > I restarted the anacron-daemon. I tested the cronjobs individually and they > > work fine. > > However, since I scheduled them I receive an email after each 5 and 15 > > minutes with the message > > /bin/bash: root: command not found > > > > I figured out that the crondaemon is trying to execute the command root. At > > some point it doesn't count the userprivilege of the cronjob. > > > > The configuration looks in mine opinion fine. Any ideas what went wrong? > > > > Thanks in advance.... > > By using "crontab -e" you're editing your personal cron file (located in > /var/spool/cron in RedHat) and there you don't need the user who is > running the commands ... so leaving out "root" from your lines should help. > > old: 3,18,33,48 * * * * root run-parts /etc/cron.quarter-hourly > new: 3,18,33,48 * * * * run-parts /etc/cron.quarter-hourly Yes and no. The differentiation here is user crontab vs. system crontab. User crontabs only permit 6 fields mim hour day month day-of-week do-this-part Only the system crontab has a 7th field. The extra field is at postion 6 and takes as an argument the username of the user under which do-this-part is to run. The following are equivalent: when logged in as user root, crontab -e 3,18,33,48 * * * * run-parts /etc/cron.quarter-hourly or edit the file /etc/crontab 3,18,33,48 * * * * root run-parts /etc/cron.quarter-hourly Andy