crontab's output question

kegger64

Registered
The output of root's cron jobs (/etc/daily, /etc/weekly, and /etc/monthly) all produce two e-mails to the root account. One is the output I expect, but the other is:

zsh: command not found: root

I haven't modified the default crontab supplied with OS X, other than to change the times when the jobs are executed.

Anybody got an explanation?
 

ka6sox

Registered
I think you have a script that is running in Zshell that has a line that has "root" on it without anything else and the shell is complaining. You might see if for example the shell want's to su to root to run and the command flags are set wrong or something like that.

ka6sox
 

holmBrew

Official Volunteer
kegger64,

have you found an answer to your question about:

zsh: command not found: root

in the daily cron output? I sure would like to know why this hapens too.
 

holmBrew

Official Volunteer
this is generated by the daily cron running /etc/daily

in the script root only shows up in this snippet:

if [ -f /etc/security ]; then
echo ""
echo "Running security:"
sh /etc/security 2>&1 | sendmail root
fi

is this what is causing the error?

/etc/security does not exist on my system.
 

holmBrew

Official Volunteer
yep, i am also having this problem, or what seems to look like a problem. i have not made any changes to the script. the article i mention below suggests some changes that i did not think were needed in my system. the old additon i made was to /var/root/.forward with the addition of my username.

i followed the directions in this article to get the daily e-mails from the cronjob (http://www.oreillynet.com/pub/a/mac/2002/01/22/terminal_pt2.html) and noticed that one e-mail is always this:

From: System Administrator <root>
Date: Mon Mar 11, 2002 03:16:02 AM US/Mountain
To: root
Subject: localhost daily output

zsh: command not found: root
 

holmBrew

Official Volunteer
this is the output to console.log during the time that /etc/daily is run by cron:

Mar 11 03:15:02 localhost sendmail[332]: My unqualified host name (localhost) unknown; sleeping for retry

Mar 11 03:15:03 localhost sendmail[337]: My unqualified host name (localhost) unknown; sleeping for retry

Mar 11 03:16:02 localhost sendmail[332]: unable to qualify my own domain name (localhost) -- using short name

Mar 11 03:16:03 localhost sendmail[337]: unable to qualify my own domain name (localhost) -- using short name

Mar 11 03:16:04 localhost sendmail[357]: My unqualified host name (localhost) unknown; sleeping for retry

Mar 11 03:17:04 localhost sendmail[357]: unable to qualify my own domain name (localhost) -- using short name

does this make sense? could it have something to do with the other zsh thing?
 

holmBrew

Official Volunteer
so, from ls -la /var/cron/tabs

[sam:~] holmBrew% sudo ls -la /var/cron/tabs
total 8
drwx------ 3 root wheel 58 Feb 8 09:23 .
drwx------ 3 root wheel 264 Dec 14 19:17 ..
-rw------- 1 root wheel 942 Feb 8 09:23 root
[sam:~] holmBrew%

so what does this mean?

everything else seems ok.
 

holmBrew

Official Volunteer
so, i SHOULD delete the one in /private/var/cron/tabs/root ?

can i just rename it to something that will be ignored?
 

blb

`'
testuser's probably right as to the source of the error, but before you delete it, see what's in it; what does
Code:
sudo crontab -l
say?
 

holmBrew

Official Volunteer
it says:

[sam:~] holmBrew% sudo crontab -l
Password:
# $NetBSD: crontab,v 1.13 1997/10/26 13:36:31 lukem Exp $
#
# /etc/crontab - root's crontab
#
SHELL=/bin/sh
PATH=/bin:/sbin:/usr/bin:/usr/sbin
HOME=/var/log

#min hour mday month wday user command

# Disabled by default, since it causes disk access every 10 minutes,
# which is useless unless you use at(1). Enable as needed.
#*/10 * * * * root /usr/libexec/atrun

# do daily/weekly/monthly maintenance
15 3 * * * root sh /etc/daily 2>&1 | tee /var/log/daily.out | mail -s "`hostname` daily output" root
30 4 * * 6 root sh /etc/weekly 2>&1 | tee /var/log/weekly.out | mail -s "`hostname` weekly output" root
30 5 1 * * root sh /etc/monthly 2>&1 | tee /var/log/monthly.out | mail -s "`hostname` monthly output" root
 

blb

`'
That is definitely /etc/crontab (cat /etc/crontab should look just like it), in which case you can delete it,
Code:
sudo crontab -r
Now the question is what caused it to get there in the first place?
 

holmBrew

Official Volunteer
well, i don't recall entering that, but who knows.

the:

sudo ctontab -l

fixed the problem. the e-mail this morning was error free.


thanks testuser and blb for all your input and help.
 
Top