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

Garrick Staples
Wed, 19 Dec 2007 16:47:42 -0000

On Wed, Dec 19, 2007 at 10:52:43AM -0600, Jeff Larsen
alleged:
> 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?

Could a previous cronjob be hanging, waiting for the initscript to finish?

I bet the daemon doesn't die as expected sometimes.

If, under some condition, the initscript could hang on the daemon, then the
cronjob would be sitting around forever.  Then you come along, restart the
daemon, and presto! the cronjob finishes and sends off the email.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL:
<http://lists.centos.org/pipermail/centos/attachments/20071219/5f9e57c5/attachment-0002.sig>