Tip (and Question) regarding crontab sysadministration
Thad P Floryan
thad at cup.portal.com
Mon Feb 5 20:49:53 AEST 1990
In a quest to simplify system administration, I desired to make the cronlog
easier to scan for any "funny business." As you know, the use of "here is"
files (e.g. command << FOO ...text... FOO) implied by using a crontab entry
such as:
16,46 * * * * /bin/su uucpadm % /usr/lib/uucp/uudemon.admin >/dev/null
produces a very cluttered cronlog. After RTFM for sh(1), ksh(1), su(1), it
still wasn't clear WHY some of the default crontab entries are like the above
entry (ref. ``%'') and why some are like the following (ref. ``-c "...." ''):
18,48 * * * * /bin/su uucpadm -c "/usr/lib/uucp/uudemon.hour >/dev/null"
crontab entries (at least on my systems) are executed as "root", so I figured
I'd switch to using "-c" for all crontab entries and see a readable cronlog.
A few entries had to be changed from "/bin/su" to "/bin/sh", but otherwise
everything works fine (even with /bin/ksh as root's shell in /etc/passwd) and
an extraction of crontab now looks like:
16,46 * * * * /bin/su uucpadm -c "/usr/lib/uucp/uudemon.poll >/dev/null"
18,48 * * * * /bin/su uucpadm -c "/usr/lib/uucp/uudemon.hour >/dev/null"
00 4 * * * /bin/su uucpadm -c "/usr/lib/uucp/uudemon.admin >/dev/null"
59 23 * * * /bin/sh -c "/usr/local/bin/hdwarn.day >/dev/null"
59 23 * * * /bin/sh -c "/usr/local/bin/du-logs.day >/dev/null"
03 3 * * 0 /bin/sh -c "/etc/clockupd.wk >/dev/null"
30 5 * * 1 /bin/su uucpadm -c "/usr/lib/uucp/uudemon.cleanu >/dev/null"
30 5 * * 1 /bin/sh -c "/etc/cleanup.wk >/dev/null"
and a corresponding sample of cronlog output now looks like the following
two hours' entries:
Mon Jan 29 23:00:00 1990
/bin/su uucpadm -c "/usr/lib/uucp/uudemon.poll >/dev/null"
/bin/su uucpadm -c "/usr/lib/uucp/uudemon.hour >/dev/null"
/bin/su uucpadm -c "/usr/lib/uucp/uudemon.poll >/dev/null"
/bin/su uucpadm -c "/usr/lib/uucp/uudemon.hour >/dev/null"
/bin/sh -c "/usr/local/bin/hdwarn.day >/dev/null"
/bin/sh -c "/usr/local/bin/du-logs.day >/dev/null"
Sun Feb 4 03:00:00 1990
/bin/sh -c "/etc/clockupd.wk >/dev/null"
/bin/su uucpadm -c "/usr/lib/uucp/uudemon.poll >/dev/null"
/bin/su uucpadm -c "/usr/lib/uucp/uudemon.hour >/dev/null"
/bin/su uucpadm -c "/usr/lib/uucp/uudemon.poll >/dev/null"
/bin/su uucpadm -c "/usr/lib/uucp/uudemon.hour >/dev/null"
I've been running one system this way for over a week now with no apparent
problems. As you can see, the cronlog entries are far easier to quickly scan.
I trust you find this tip useful!
However, I'm still puzzled why ALL the default examples I've seen in crontabs
on many systems mix both the "%" and "-c" usage in the same file. Is there
any real reason for invoking (otherwise similar) scripts using one method or
the other?
Thad Floryan [ thad at cup.portal.com (OR) ..!sun!portal!cup.portal.com!thad ]
More information about the Comp.sys.att
mailing list