Add info about script usage and simplify it
This commit is contained in:
parent
914b9752d1
commit
971197c633
|
@ -3,7 +3,8 @@
|
||||||
pidfile=/tmp/sparkleshare/sparkleshare.pid
|
pidfile=/tmp/sparkleshare/sparkleshare.pid
|
||||||
|
|
||||||
# Create a directory to save the pid to
|
# Create a directory to save the pid to
|
||||||
if [[ "$1" == "start" ]]; then
|
case $1 in
|
||||||
|
start)
|
||||||
if [ -e "${pidfile}" ]; then
|
if [ -e "${pidfile}" ]; then
|
||||||
sparklepid=`cat ${pidfile}`
|
sparklepid=`cat ${pidfile}`
|
||||||
if [ -n "`ps -p ${sparklepid} | grep ${sparklepid}`" ]
|
if [ -n "`ps -p ${sparklepid} | grep ${sparklepid}`" ]
|
||||||
|
@ -23,9 +24,9 @@ if [[ "$1" == "start" ]]; then
|
||||||
PID=$!
|
PID=$!
|
||||||
echo $PID > /tmp/sparkleshare/sparkleshare.pid
|
echo $PID > /tmp/sparkleshare/sparkleshare.pid
|
||||||
echo " Done."
|
echo " Done."
|
||||||
fi
|
;;
|
||||||
|
|
||||||
if [[ "$1" == "stop" ]]; then
|
stop)
|
||||||
if [ -e "/tmp/sparkleshare/sparkleshare.pid" ]; then
|
if [ -e "/tmp/sparkleshare/sparkleshare.pid" ]; then
|
||||||
echo -n "Stopping SparkleShare..."
|
echo -n "Stopping SparkleShare..."
|
||||||
kill `cat /tmp/sparkleshare/sparkleshare.pid`
|
kill `cat /tmp/sparkleshare/sparkleshare.pid`
|
||||||
|
@ -34,9 +35,9 @@ if [[ "$1" == "stop" ]]; then
|
||||||
else
|
else
|
||||||
echo "SparkleShare isn't running."
|
echo "SparkleShare isn't running."
|
||||||
fi
|
fi
|
||||||
fi
|
;;
|
||||||
|
|
||||||
if [[ "$1" == "restart" ]]; then
|
restart)
|
||||||
if [ -e "/tmp/sparkleshare/sparkleshare.pid" ]; then
|
if [ -e "/tmp/sparkleshare/sparkleshare.pid" ]; then
|
||||||
echo -n "Stopping SparkleShare..."
|
echo -n "Stopping SparkleShare..."
|
||||||
kill `cat /tmp/sparkleshare/sparkleshare.pid`
|
kill `cat /tmp/sparkleshare/sparkleshare.pid`
|
||||||
|
@ -57,8 +58,13 @@ if [[ "$1" == "restart" ]]; then
|
||||||
echo $PID > /tmp/sparkleshare/sparkleshare.pid
|
echo $PID > /tmp/sparkleshare/sparkleshare.pid
|
||||||
echo " Done."
|
echo " Done."
|
||||||
fi
|
fi
|
||||||
fi
|
;;
|
||||||
|
|
||||||
if [[ "$1" == "--help" ]]; then
|
--help | help)
|
||||||
mono "@expanded_libdir@/@PACKAGE@/SparkleShare.exe" --help
|
mono "@expanded_libdir@/@PACKAGE@/SparkleShare.exe" --help
|
||||||
fi
|
;;
|
||||||
|
|
||||||
|
*)
|
||||||
|
echo "Usage: sparkleshare {start|stop|restart|help}"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
Loading…
Reference in a new issue