Problems With Restarting NTOP with Cron Job on Debian 5 Lenny

Posted on July 28th, 2009


Bah, so another bug was found and fixed by 7L. There is a small bug when restarting NTOP using Cron Daemon.

I’ve found there was a $PATH issue. Default $PATH was “/usr/bin:/bin”

—————————————————————————-

ntop:/etc/bandwidth# crontab -l
# m h dom mon dow command
0 0 * * * /etc/init.d/ntop restart

————————————————————————–

When I ran the cron job, it had some flipping errors such as:

Stopping network top daemon: /etc/init.d/ntop: line 31: start-stop-daemon: command not found Ntop not stopped. Need to kill manually. Starting network top daemon: /etc/init.d/ntop: line 19: start-stop-daemon: command not found

So, I’ve added $SHELL and $PATH into crontap

————————————————————————–

ntop:/etc/bandwidth# crontab -l
SHELL=/bin/sh
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
# m h dom mon dow command
0 0 * * * /etc/init.d/ntop restart

————————————————————————–

Voila it works! = )

All this and more, keep coming back for more tips and hot tricks ^_^.

Over and Out,