Ok thanks everyone for the responses. Some questions and clarifications.
Where is the cron log? I don't see one specifically for cron.
How would I add logging to the script?
According to the way I read the crontab entry, the script should be called by the run-parts script as root. If this is the case then it should have rights to write to the file.
Yes, I'm still rather new at scripting and cron.
I'm only using cat grep and awk in the script and all paths are fully qualified. The file that the script is writing to is set up exactly like the log files in /var/log. I had considered making it world writtable for debugging, but that wouldn't solve my problem, because I want to lock it down. So I guess I need to figure out "who" is running cron jobs, although I thought it was root.
------------------------------------------------------------ /etc/crontab # /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. # This file also has a username field, 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 25 6 * * * root test -e /usr/sbin/anacron || run-parts --report /etc/cron.daily 47 6 * * 7 root test -e /usr/sbin/anacron || run-parts --report /etc/cron.weekly 52 6 1 * * root test -e /usr/sbin/anacron || run-parts --report /etc/cron.monthly #
---------------------------------------------------- My holding blacklist file particulars of import rw-r--r-- root.adm /etc/illegalips.txt
-----Original Message----- From: Jonathan Hutchins
May I suggest you develop some logging or error reporting that shows you if the script is getting called?
-----Original Message----- From: Dan
Just a guess, but cron doesn't know about your $PATH
-----Original Message----- From: John M Geiger
what is the setting in your /etc/crontab file for running daily jobs? I have to believe the script is being kicked off by cron but, as someone else has noted, may have a PATH problem or other environmental variable problem of some sort.
Or, just to make sure, the ID that your blacklist script runs under does have permission to update the blacklist hold file, right?
"Gerald Combs" [email protected] wrote:
Most of my local crontab entries look something like:
30 5 * * * /path/to/script > /path/to/script.log 2>&1
Each time "script" runs, stdout and stderr are written to "script.log".
I usually direct to /tmp/script.log (or some other directory obviously intended to hold files that change on a regular basis) instead, because I'm trying to keep good discipline and not have the executables (which could be; and arguably SHOULD be, in a filesystem mounted read-only) in the same directories as the log files (which obviously can't)
On Wed, Oct 27, 2004 at 10:09:27AM -0500, Brian Densmore wrote:
How would I add logging to the script?
With the "logger" command, executed as a part of the script, eg:
#!/bin/bsh
logger "I'm starting to do stuff!" /usr/bin/do some stuff /usr/bin/do some other stuff logger "I'm done doing stuff!"
The lines "I'm starting to do stuff!" and "I'm done doing stuff!" would show up in your logs, syslog I think but depends on the specifics of your configuration.
-- Joe
On Wed, Oct 27, 2004 at 10:09:27AM -0500, Brian Densmore wrote:
How would I add logging to the script?
With the "logger" command, executed as a part of the script, eg:
#!/bin/bsh
logger "I'm starting to do stuff!" /usr/bin/do some stuff /usr/bin/do some other stuff logger "I'm done doing stuff!"
The lines "I'm starting to do stuff!" and "I'm done doing stuff!" would show up in your logs, syslog I think but depends on the specifics of your configuration.
-- Joe