[cli] remove pid file when sparkleshare isn't running

This commit is contained in:
Michael Monreal 2010-08-12 09:42:22 +01:00 committed by Hylke Bons
parent 125440071c
commit e52d65e4d8
2 changed files with 13 additions and 5 deletions

View file

@ -13,6 +13,7 @@ Contributors:
Jakub Steiner <jimmac@novell.com>
Lapo Calamandrei <calamandrei@gmail.com>
Łukasz Jernaś <deejay1@srem.org>
Michael Monreal <michael.monreal@gmail.com>
Oleg Khlystov <pktfag@gmail.com>
Philipp Gildein <rmbl@openspeak-project.org>
Ruben Vermeersch <rubenv@gnome.org>

View file

@ -27,11 +27,17 @@ case $1 in
;;
stop)
if [ -e "/tmp/sparkleshare/sparkleshare.pid" ]; then
echo -n "Stopping SparkleShare..."
kill `cat /tmp/sparkleshare/sparkleshare.pid`
rm -f /tmp/sparkleshare/sparkleshare.pid
echo " Done."
if [ -e "${pidfile}" ]; then
sparklepid=`cat ${pidfile}`
if [ -n "`ps -p ${sparklepid} | grep ${sparklepid}`" ]; then
echo -n "Stopping SparkleShare..."
kill ${sparklepid}
rm -f ${pidfile}
echo " Done."
else
echo "SparkleShare isn't running, removing stale pid file"
rm -f ${pidfile}
fi
else
echo "SparkleShare isn't running."
fi
@ -67,4 +73,5 @@ case $1 in
*)
echo "Usage: sparkleshare {start|stop|restart|help}"
;;
esac