[KLUG Members] Cron
Peter Buxton
members@kalamazoolinux.org
Mon, 15 Sep 2003 01:11:58 -0400
On Sun, Sep 14, 2003 at 09:28:59AM -0400, bfdamkoehler@worldnet.att.net was only escaped
alone to tell thee:
> You get a very minimal environment from a cron script.
True. Setting the command 'env | sort' in `crontab -e` shows:
HOME=/var/home/peter
LOGNAME=peter
PATH=/usr/bin:/bin
PWD=/var/home/peter
SHELL=/bin/sh
SHLVL=1
whereas my normal env under bash runs 30 entries. You can set any
environment variable in your crontab, not just PATH, exactly as you'd
set it in a sh script.
lunitix's crontab entries look okay, though... lunitix, where and how
are you entering your cron jobs? Do you use the command `crontab -e`? I
noticed that the crontab command on Debian logs user changes to syslog:
Sep 15 00:43:33 grimace crontab[651]: (peter) BEGIN EDIT (peter)
Sep 15 00:43:54 grimace crontab[651]: (peter) REPLACE (peter)
Sep 15 00:43:54 grimace crontab[651]: (peter) END EDIT (peter)
Sep 15 00:44:01 grimace /usr/sbin/cron[393]: (peter) RELOAD (crontabs/peter)
Sep 15 00:44:02 grimace /USR/SBIN/CRON[656]: (peter) CMD (env|sort)
Sep 15 00:44:09 grimace crontab[664]: (peter) BEGIN EDIT (peter)
Sep 15 00:44:16 grimace crontab[664]: (peter) REPLACE (peter)
Sep 15 00:44:16 grimace crontab[664]: (peter) END EDIT (peter)
I imagine other Linux distros do the same. What do you see in the log
files, and in /var/spool/cron/crontabs?
> When you get your script running you will probably want to turn off
> the mail messages from cron. To do so add " >/dev/null 2>/dev/null" to
> the end of your cron line.
Yup. And:
command &> /dev/null
{ command1 ; command2 ; } &> /dev/null
also redirect both stdout and stderr to /dev/null.
--
-4
You can fill my head with Gummi Bears,
but I won't talk! -- Tom Servo, K13.