[CentOS] Getting email from cron when script is run manually

Jeff Larsen
Wed, 19 Dec 2007 16:52:43 -0000

We have some third party software running on a CentOS 4.5 virtual
machine. The software is delivered as compiled python and I wrote an
init script for it myself (/etc/init.d/gk). Because the software lacks
the usual robustness of CentOS services, I have a bash script
(/etc/cron.daily/gk-restart) which simply calls "/etc/init.d/gk
restart". So, as expected, root gets an email every day when cron runs
the script.

Here's the puzzling part: If I need to manually restart the service, I
will use the command "/etc/init.d/gk restart". But then I get the very
same email message from the cron daemon as if the daily cron job had
been run automatically. The email is timestamped for the time at which
I manually restarted the service. How on earth is the manual restart
being monitored by the cron daemon?

The init script is full featured and maintains pid and lock files in
/var/run and /var/lock/subsys respectively. Is that the connection?

Jeff