SparkleShare/sparkleshare

65 lines
1.6 KiB
Plaintext
Raw Normal View History

2010-04-27 17:19:36 +00:00
#!/bin/bash
pidfile=/tmp/sparkleshare/sparkleshare.pid
# Create a directory to save the pid to
2010-04-27 17:19:36 +00:00
if [[ "$1" == "start" ]]; then
if [ -e "${pidfile}" ]; then
sparklepid=`cat ${pidfile}`
if [ -n "`ps -p ${sparklepid} | grep ${sparklepid}`" ]
then
echo "SparkleShare is already running"
exit 0
else
echo "SparkleShare stale pid file found, starting a new instance"
rm -f $pidfile
fi
fi
echo -n "Starting SparkleShare..."
mkdir -p /tmp/sparkleshare/
# Start SparkleShare in the background and save the pid
mono /usr/local/share/sparkleshare/SparkleShare.exe $2 &
PID=$!
echo $PID > /tmp/sparkleshare/sparkleshare.pid
echo " Done."
fi
if [[ "$1" == "stop" ]]; then
2010-05-03 00:14:27 +00:00
if [ -e "/tmp/sparkleshare/sparkleshare.pid" ]; then
echo -n "Stopping SparkleShare..."
kill `cat /tmp/sparkleshare/sparkleshare.pid`
rm -f /tmp/sparkleshare/sparkleshare.pid
2010-04-28 00:07:43 +00:00
echo " Done."
2010-04-27 17:19:36 +00:00
else
2010-05-03 00:14:27 +00:00
echo "SparkleShare isn't running."
2010-04-27 17:19:36 +00:00
fi
fi
if [[ "$1" == "restart" ]]; then
2010-05-03 00:14:27 +00:00
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."
else
2010-05-03 00:14:27 +00:00
echo "SparkleShare isn't running."
fi
2010-05-03 00:14:27 +00:00
if [ -e "/tmp/sparkleshare/sparkleshare.pid" ]; then
echo "SparkleShare is already running."
else
2010-05-03 00:14:27 +00:00
echo -n "Starting SparkleShare..."
2010-05-03 00:14:27 +00:00
# Start SparkleShare in the background and save the pid
mono /usr/local/share/sparkleshare/SparkleShare.exe $2 &
PID=$!
2010-05-03 00:14:27 +00:00
echo $PID > /tmp/sparkleshare/sparkleshare.pid
echo " Done."
fi
fi
if [[ "$1" == "--help" ]]; then
2010-05-03 00:14:27 +00:00
mono /usr/local/share/sparkleshare/SparkleShare.exe --help
fi