add a graceful restart option to kojid.init
This commit is contained in:
parent
a51ad5031f
commit
508b739120
3 changed files with 19 additions and 2 deletions
|
|
@ -81,7 +81,11 @@ def main(options, session):
|
|||
tm.scanPlugin(pt.load(name))
|
||||
def shutdown(*args):
|
||||
raise SystemExit
|
||||
def restart(*args):
|
||||
logger.warn("Initiating graceful restart")
|
||||
tm.restart_pending = True
|
||||
signal.signal(signal.SIGTERM,shutdown)
|
||||
signal.signal(signal.SIGUSR1,restart)
|
||||
taken = False
|
||||
while 1:
|
||||
try:
|
||||
|
|
|
|||
|
|
@ -60,6 +60,17 @@ restart() {
|
|||
start
|
||||
}
|
||||
|
||||
graceful() {
|
||||
#SIGUSR1 initiates a graceful restart
|
||||
pid=$(pidofproc kojid)
|
||||
if test -z "$pid"
|
||||
then
|
||||
echo $"$prog not running"
|
||||
else
|
||||
kill -10 $pid
|
||||
fi
|
||||
}
|
||||
|
||||
# See how we were called.
|
||||
case "$1" in
|
||||
start)
|
||||
|
|
@ -77,8 +88,11 @@ case "$1" in
|
|||
condrestart|try-restart)
|
||||
[ -f /var/lock/subsys/kojid ] && restart || :
|
||||
;;
|
||||
graceful)
|
||||
graceful
|
||||
;;
|
||||
*)
|
||||
echo $"Usage: $0 {start|stop|status|restart|condrestart|try-restart|reload|force-reload}"
|
||||
echo $"Usage: $0 {start|stop|status|restart|condrestart|try-restart|reload|force-reload|graceful}"
|
||||
exit 1
|
||||
esac
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue