Cron vs. Command Line Problems

David Kramer david at thekramers.net
Sat Aug 7 15:21:50 UTC 2004


David Cary Hart wrote, On 08/07/2004 10:59 AM:
> I have snort set up as a service. From the command line I can do
> "service snort restart" and it performs precisely as expected.
> 
> Snort requires a restart after log rotate or it follows the old
> alert.log. I have tried to do this a) via a cronned script, b) in the
> logrotate script and c) by simply cronning the restart command line with
> no joy.
> 
> What am I missing?

What you are missing is that both logrotate and cron are not you.  More 
specifically, they do not have your environment variables, including $PATH. 
You must either set the PATH at the top of the crontab file, or use hard-coded 
paths for every file you specify.  I recommend the latter.

Trick #2: remember to redirect stdout and stderror of new crontab entries you 
are testing out, so you can see error messages.

----------------------------------------------------------------------------
DDDD   David Kramer         david at thekramers.net       http://thekramers.net
DK KD  "It is practically impossible to teach good programming concepts to
DKK D  students who have had prior exposure to BASIC. As potential
DK KD  programmers they are mutilated beyond hope of redemption."
DDDD                                  -Edsger Wybe Dijkstra, RIP 1930 - 2002





More information about the users mailing list