[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Cron 101: Cron message "/bin/sh: root: command not found"



On 11/05/2014 11:43, Filip wrote:
On Sun, 11 May 2014 10:37:31 +0100
Ron Leach<ronleach@tesco.net>  wrote:

I'm missing some aspect of cron configuration, or perhaps some other
cron file somewhere.  root doesn't have a /home directory, so there
isn't a crontab in it, and the only user existing on the system
doesn't have a crontab in its home directory, either.


Look in /var/spool/cron/crontabs. That is the location of the per-user
crontabs.

If someone copied the line

17 *  * * *	root	cd /&&  run-parts--report /etc/cron.hourly

in there, you would get the error you mentioned, because root will be
interpretet as the command to run, because these crontabs have a
different format.



First, thank you and Andrei for removing the 'mystery' of where the other crontabs are; relieved, thank you both.

/var/spool/cron/crontabs/root indeed contains exactly the error you mention:

# DO NOT EDIT THIS FILE - edit the master and reinstall.
# (/tmp/crontab.jE2KHC/crontab installed on Fri Dec 31 08:54:50 2010)
# (Cron version -- $Id: crontab.c,v 2.13 1994/01/17 03:20:37 vixie Exp $)
# /etc/crontab: system-wide crontab
# Unlike any other crontab you don't have to run the `crontab'
# command to install the new version when you edit this file
# and files in /etc/cron.d. These files also have username fields,
# that none of the other crontabs do.

SHELL=/bin/sh
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin

# m h dom mon dow user  command
17 *    * * *   root    cd / && run-parts --report /etc/cron.hourly

Filip, the comment suggests that I shouldn't edit this file here. Do you have any idea where, or what, its 'master' version might be? When we first built the server, we used webmin to obtain some visibility of system administration things, and we did use webmin's cron management facility. We long ceased doing so, the current regular backups are written directly into /etc/crontab, for example. But I mention webmin in case it might have placed that warning in this file. If so, then I'm happy changing root's crontab here because we don't use webmin any more, anyway, and it won't change this file. But, if this file is managed from somewhere else, changing the file here would probably be the wrong thing to do.

regards, Ron


Reply to: