On Fri, 3 Dec 2010, m.roth@5-cent.us wrote:
To: CentOS mailing list centos@centos.org From: m.roth@5-cent.us Subject: Re: [CentOS] shutdown script
Michael D. Berger wrote:
I have a daemon that throws an exception whenever I shutdown or reboot. However, stopping it with kill -15, or calling the stop command in its start stop script (in /etc/init.d/) results in correct termination.
Therefore, might it be that shutdown or reboot call an initial script in which I can stop the daemon, and then delay a little?
Is this any good?
#! /bin/bash
# Bash script to perform a gracefull shutdown of apache web server # called from /root/root-admin-scripts/databases/fedora-8-mysql/ # backup-mysql-databases.php # DO NOT DELETE! #------------------------------------------------------#
# seconds to wait for apache to shutdown APACHE_GRACE_TIME=10
# output the current version of apache apachectl -v echo ""
# gracefully shut-down the apache web server apachectl graceful-stop
echo "Shutting down Apache web server..." echo "Waiting $APACHE_GRACE_TIME seconds for Apache web server to finish..."
# wait for apache to shutdown properly sleep $APACHE_GRACE_TIME
exit 0
#------------------------------------------------------#
I wanted to shutdown Apache so it was not updating MySQL databases when the backup script ran ;)
Regards,
Keith Roberts