From ce62916b6ed09f63ea336483cfe9e8d5ae87736e Mon Sep 17 00:00:00 2001 From: "Daniel P. Berrange" Date: Thu, 12 Nov 2009 19:31:48 +0000 Subject: [PATCH] Fix initscript to check daemon pidfile The libvirtd initscript could get confused between the system and session instances of the daemon. To avoid this it is neccessary to check the pidfile explicitly. * daemon/libvirtd.init.in: Always check the pidfile of the system daemon to avoid confusion with the session daemons --- daemon/libvirtd.init.in | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/daemon/libvirtd.init.in b/daemon/libvirtd.init.in index 43c2d686a0..071fe2c0a4 100644 --- a/daemon/libvirtd.init.in +++ b/daemon/libvirtd.init.in @@ -40,6 +40,7 @@ SERVICE=libvirtd PROCESS=libvirtd +PIDFILE=@localstatedir@/run/$SERVICE.pid LIBVIRTD_CONFIG= LIBVIRTD_ARGS= @@ -59,7 +60,7 @@ start() { echo -n $"Starting $SERVICE daemon: " mkdir -p @localstatedir@/cache/libvirt rm -rf @localstatedir@/cache/libvirt/* - KRB5_KTNAME=$KRB5_KTNAME daemon --check $SERVICE $PROCESS --daemon $LIBVIRTD_CONFIG_ARGS $LIBVIRTD_ARGS + KRB5_KTNAME=$KRB5_KTNAME daemon --pidfile $PIDFILE --check $SERVICE $PROCESS --daemon $LIBVIRTD_CONFIG_ARGS $LIBVIRTD_ARGS RETVAL=$? echo [ $RETVAL -eq 0 ] && touch @localstatedir@/lock/subsys/$SERVICE @@ -68,12 +69,12 @@ start() { stop() { echo -n $"Stopping $SERVICE daemon: " - killproc $PROCESS + killproc -p $PIDFILE $PROCESS RETVAL=$? echo if [ $RETVAL -eq 0 ]; then rm -f @localstatedir@/lock/subsys/$SERVICE - rm -f @localstatedir@/run/$SERVICE.pid + rm -f $PIDFILE rm -rf @localstatedir@/cache/libvirt/* fi } @@ -86,7 +87,7 @@ restart() { reload() { echo -n $"Reloading $SERVICE configuration: " - killproc $PROCESS -HUP + killproc -p $PIDFILE $PROCESS -HUP RETVAL=$? echo return $RETVAL @@ -98,7 +99,7 @@ case "$1" in $1 ;; status) - status $PROCESS + status -p $PIDFILE $PROCESS RETVAL=$? ;; force-reload)