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?
Thanks, Mike.
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?
Wait - what I get from what you say, above, is that it's not killed by its script in /etc/init.d: why not? What's the output from chkconfig --list <servicename>?
mark
On Fri, 03 Dec 2010 15:43:10 -0500, m.roth-x6lchVBUigD1P9xLtpHBDw wrote:
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?
Wait - what I get from what you say, above, is that it's not killed by its script in /etc/init.d: why not? What's the output from chkconfig --list <servicename>?
mark
No, chkconfig returns the correct result, and the proper links appear in /etc/rc.d/... . The daemon is complex, and there is plenty that might slow down a shutdown. BTW, its control script contains:
# chkconfig: 35 97 3
so am giving it plenty of time, but perhaps not enough. Furthermore, the daemon name appears in the shutdown listing in the expected way.
Mike.
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
On Fri, 03 Dec 2010 23:20:17 +0000, Keith Roberts wrote:
On Fri, 3 Dec 2010, m.roth@5-cent.us wrote:
[...]
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
I could write a script that shuts down my client and then calls shutdown, but I was hoping to call a script from the shutdown procedure that would complete before the rest of the shutdown.
Mike.