Cron 101: Cron message /bin/sh: root: command not found
List good morning, I do regret asking such a basic question about cron, but I cannot seem to get rid of what I think is a mis-configured entry, somewhere. We have a server running Lenny (still), its role is solely to provide a network file system. Every 17 mins past the hour, root is sending an email with this title: Cron root@server4 root cd / run-parts --report /etc/cron.hourly and content: /bin/sh: root: command not found In /etc/cron.d there are only files for anacron and mdadm; neither of these have entries for every 17 mins past the hour. In /etc/cron.hourly there is only an empty .placeholder file. I've tried commenting out relevant entries in /etc/crontab, but without effect. /etc/crontab contains: # was executing 'root' so commented out; still error messages # 17 * * * * cd / run-parts --report /etc/cron.hourly and, as a last resort a couple of days ago: # disabled because of multiple error messages in email but no effect # 17 * * * * rootcd / run-parts --report /etc/cron.hourly Hourly email messages still occur. I would guess this second crontab entry was - in practice - ok, and perhaps I should re-enable it for system purposes, anyway. I checked /etc/anacrontab in case it could be involved, it seems not to contain any cron.hourly entries, nor entries at the relevant time: SHELL=/bin/sh PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin # These replace cron's entries 1 5 cron.daily nice run-parts --report /etc/cron.daily 7 10 cron.weekly nice run-parts --report /etc/cron.weekly @monthly15 cron.monthly nice run-parts --report /etc/cron.monthly 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. I enjoy mysteries. This one is beginning to frustrate, though. I've misunderstood something about cron, but what is it? regards, Ron -- To UNSUBSCRIBE, email to debian-user-requ...@lists.debian.org with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org Archive: https://lists.debian.org/536f44db.2030...@tesco.net
Re: Cron 101: Cron message /bin/sh: root: command not found
Am Sonntag, 11. Mai 2014, 10:37:31 schrieb Ron Leach: List good morning, Hi Ron, I do regret asking such a basic question about cron, but I cannot seem to get rid of what I think is a mis-configured entry, somewhere. We have a server running Lenny (still), its role is solely to provide a network file system. Every 17 mins past the hour, root is sending an email with this title: Cron root@server4 root cd / run-parts --report /etc/cron.hourly and content: /bin/sh: root: command not found This means that a cron job tries to run the command root which does not exist. In /etc/cron.d there are only files for anacron and mdadm; neither of these have entries for every 17 mins past the hour. In /etc/cron.hourly there is only an empty .placeholder file. I've tried commenting out relevant entries in /etc/crontab, but without effect. /etc/crontab contains: # was executing 'root' so commented out; still error messages # 17 * * * * cd / run-parts --report /etc/cron.hourly and, as a last resort a couple of days ago: # disabled because of multiple error messages in email but no effect # 17 * * * * rootcd / run-parts --report /etc/cron.hourly Look into - /etc/cron.d - crontab -l It would not make much sense, but maybe someone added a call to /etc/cron.hourly there. Ciao, -- Martin 'Helios' Steigerwald - http://www.Lichtvoll.de GPG: 03B0 0D6C 0040 0710 4AFA B82F 991B EAAC A599 84C7 -- To UNSUBSCRIBE, email to debian-user-requ...@lists.debian.org with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org Archive: https://lists.debian.org/4503143.MZaMq2lnWk@merkaba
Re: Cron 101: Cron message /bin/sh: root: command not found
On Du, 11 mai 14, 10:37:31, Ron Leach wrote: I checked /etc/anacrontab in case it could be involved, it seems not to contain any cron.hourly entries, nor entries at the relevant time: SHELL=/bin/sh PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin # These replace cron's entries 1 5 cron.daily nice run-parts --report /etc/cron.daily 7 10 cron.weekly nice run-parts --report /etc/cron.weekly @monthly15 cron.monthly nice run-parts --report /etc/cron.monthly To make things simpler I would purge anacron, especially if this is a server that is (mostly) on. 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. crontabs are *not* stored in home, but in /var/spool/cron/crontabs/ Kind regards, Andrei -- http://wiki.debian.org/FAQsFromDebianUser Offtopic discussions among Debian users and developers: http://lists.alioth.debian.org/mailman/listinfo/d-community-offtopic http://nuvreauspam.ro/gpg-transition.txt signature.asc Description: Digital signature
Re: Cron 101: Cron message /bin/sh: root: command not found
On Sun, 11 May 2014 10:37:31 +0100 Ron Leach ronle...@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 * * * * rootcd / 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. -- To UNSUBSCRIBE, email to debian-user-requ...@lists.debian.org with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org Archive: https://lists.debian.org/20140511124340.7ef7a...@orac.fil
Re: Cron 101: Cron message /bin/sh: root: command not found
On 11/05/2014 10:48, Martin Steigerwald wrote: Look into - /etc/cron.d - crontab -l It would not make much sense, but maybe someone added a call to /etc/cron.hourly there. server4:/# crontab -l # /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 ** * * rootcd / run-parts --report /etc/cron.hourly 25 6* * * roottest -x /usr/sbin/anacron || ( cd / run-parts --report /etc/cron.daily ) 47 6* * 7 roottest -x /usr/sbin/anacron || ( cd / run-parts --report /etc/cron.weekly ) 52 61 * * roottest -x /usr/sbin/anacron || ( cd / run-parts --report /etc/cron.monthly ) # # 24 10 * * * ron rdiff-backup --print-statistics -v3 /nfs ron@server5::/sata1tb/backup/filestorebak # 24 13 * * * ron rdiff-backup --print-statistics -v3 /nfs ron@server5::/sata1tb/backup/filestorebak # 24 16 * * * ron rdiff-backup --print-statistics -v3 /nfs ron@server5::/sata1tb/backup/filestorebak # 24 19 * * * ron rdiff-backup --print-statistics -v3 /nfs ron@server5::/sata1tb/backup/filestorebak # # How very odd. That isn't the content of /etc/crontab . That's the content of a much earlier cron arrangement we had before we reconfigured some of the servers, a couple of years ago. It also does not contain our existing nfs backup cronjob (which regularly runs happily and sends a confirming email). So this output of crontab -l is *not* /etc/crontab. *Neither* is it reporting all the current cron jobs that run. /etc/cron.d only contains anacron and mdadm; the anacron entry is for 07:30 every day (so not causing our hourly problem) and mdadm is a monthly check. Grateful for the tip, Martin. EDIT: I see from Andrei's and Filip's replies that this report may be picking up root's crontab from /var/spool/cron/crontabs . Ron -- To UNSUBSCRIBE, email to debian-user-requ...@lists.debian.org with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org Archive: https://lists.debian.org/536f56aa.2050...@tesco.net
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 Leachronle...@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 * * * * rootcd / 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 ** * * rootcd / 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 -- To UNSUBSCRIBE, email to debian-user-requ...@lists.debian.org with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org Archive: https://lists.debian.org/536f5a03.4010...@tesco.net
Re: Cron 101: Cron message /bin/sh: root: command not found
On Du, 11 mai 14, 11:53:30, Ron Leach wrote: server4:/# crontab -l # /etc/crontab: system-wide crontab I seriously doubt that. [...] How very odd. That isn't the content of /etc/crontab . Since it seems like you executed 'crontab -l' as root is seems like it is the crontab of the 'root' user. EDIT: I see from Andrei's and Filip's replies that this report may be picking up root's crontab from /var/spool/cron/crontabs . Looks like it. You could (as root): crontab -l root_crontab crontab -r and see if you still get the error. Later you can diff the root_crontab file with /etc/crontab and see if there's anything useful in there to migrate to the real system-wide crontab. Kind regards, Andrei -- http://wiki.debian.org/FAQsFromDebianUser Offtopic discussions among Debian users and developers: http://lists.alioth.debian.org/mailman/listinfo/d-community-offtopic http://nuvreauspam.ro/gpg-transition.txt signature.asc Description: Digital signature
Re: Cron 101: Cron message /bin/sh: root: command not found
On Sun, 11 May 2014 12:07:47 +0100 Ron Leach ronle...@tesco.net wrote: 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? The correct way to edit the per-user crontabs it with # crontab -u user -e -- To UNSUBSCRIBE, email to debian-user-requ...@lists.debian.org with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org Archive: https://lists.debian.org/20140511131352.29880...@orac.fil
Re: Cron 101: Cron message /bin/sh: root: command not found
Am Sonntag, 11. Mai 2014, 11:53:30 schrieb Ron Leach: On 11/05/2014 10:48, Martin Steigerwald wrote: Look into - /etc/cron.d - crontab -l It would not make much sense, but maybe someone added a call to /etc/cron.hourly there. server4:/# crontab -l # /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 ** * * rootcd / run-parts --report /etc/cron.hourly Gotcha. How very odd. That isn't the content of /etc/crontab . No, but of EDIT: I see from Andrei's and Filip's replies that this report may be picking up root's crontab from /var/spool/cron/crontabs . as crontab -l displays :) crontab is for editing, listing, removing user crontabs, including the user crontab of the root user. Ciao, -- Martin 'Helios' Steigerwald - http://www.Lichtvoll.de GPG: 03B0 0D6C 0040 0710 4AFA B82F 991B EAAC A599 84C7 -- To UNSUBSCRIBE, email to debian-user-requ...@lists.debian.org with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org Archive: https://lists.debian.org/1499292.CrjjCInt3b@merkaba
Re: Cron 101: Cron message /bin/sh: root: command not found
On Du, 11 mai 14, 12:07:47, Ron Leach wrote: /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 ** * * rootcd / run-parts --report /etc/cron.hourly Filip, the comment suggests that I shouldn't edit this file here. Actually you have no way of knowing this. That part could have just been copy-pasted by someone mistaking root's crontab with the system crontab (/etc/crontab). The presence of a 'user' field seems to support this. My suggestion still stands: keep the content of root's crontab somewhere (just in case), but remove it. Kind regards, Andrei -- http://wiki.debian.org/FAQsFromDebianUser Offtopic discussions among Debian users and developers: http://lists.alioth.debian.org/mailman/listinfo/d-community-offtopic http://nuvreauspam.ro/gpg-transition.txt signature.asc Description: Digital signature