2010-04-27 17:19:36 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
2010-04-27 22:37:29 +00:00
|
|
|
# Create a directory to save the pid to
|
2010-05-03 00:14:27 +00:00
|
|
|
mkdir -p /tmp/sparkleshare/
|
2010-04-27 22:37:29 +00:00
|
|
|
|
2010-04-27 17:19:36 +00:00
|
|
|
if [[ "$1" == "start" ]]; then
|
2010-05-03 00:14:27 +00:00
|
|
|
if [ -e "/tmp/sparkleshare/sparkleshare.pid" ]; then
|
|
|
|
echo "SparkleShare is already running."
|
2010-04-27 22:37:29 +00:00
|
|
|
else
|
2010-05-03 00:14:27 +00:00
|
|
|
echo -n "Starting SparkleShare..."
|
2010-04-27 22:37:29 +00:00
|
|
|
|
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 &
|
2010-04-27 22:37:29 +00:00
|
|
|
PID=$!
|
2010-05-03 00:14:27 +00:00
|
|
|
echo $PID > /tmp/sparkleshare/sparkleshare.pid
|
2010-04-27 22:37:29 +00:00
|
|
|
echo " Done."
|
|
|
|
fi
|
|
|
|
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
|
2010-04-27 22:46:38 +00:00
|
|
|
|
2010-04-28 23:16:28 +00:00
|
|
|
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
|
2010-04-28 23:16:28 +00:00
|
|
|
echo " Done."
|
|
|
|
else
|
2010-05-03 00:14:27 +00:00
|
|
|
echo "SparkleShare isn't running."
|
2010-04-28 23:16:28 +00:00
|
|
|
fi
|
|
|
|
|
2010-05-03 00:14:27 +00:00
|
|
|
if [ -e "/tmp/sparkleshare/sparkleshare.pid" ]; then
|
|
|
|
echo "SparkleShare is already running."
|
2010-04-28 23:16:28 +00:00
|
|
|
else
|
2010-05-03 00:14:27 +00:00
|
|
|
echo -n "Starting SparkleShare..."
|
2010-04-28 23:16:28 +00:00
|
|
|
|
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 &
|
2010-04-28 23:16:28 +00:00
|
|
|
PID=$!
|
2010-05-03 00:14:27 +00:00
|
|
|
echo $PID > /tmp/sparkleshare/sparkleshare.pid
|
2010-04-28 23:16:28 +00:00
|
|
|
echo " Done."
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
2010-04-27 22:46:38 +00:00
|
|
|
if [[ "$1" == "--help" ]]; then
|
2010-05-03 00:14:27 +00:00
|
|
|
mono /usr/local/share/sparkleshare/SparkleShare.exe --help
|
2010-04-27 22:46:38 +00:00
|
|
|
fi
|