Update bash script
This commit is contained in:
parent
85241df6ca
commit
0d95c2a10c
|
@ -1,3 +1,64 @@
|
||||||
#!/bin/sh
|
#!/bin/bash
|
||||||
|
|
||||||
exec mono "@expanded_libdir@/@PACKAGE@/SparkleShare.exe" "$@"
|
pidfile=/tmp/sparkleshare/sparkleshare.pid
|
||||||
|
|
||||||
|
# Create a directory to save the pid to
|
||||||
|
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 "@expanded_libdir@/@PACKAGE@/SparkleShare.exe" $2 &
|
||||||
|
PID=$!
|
||||||
|
echo $PID > /tmp/sparkleshare/sparkleshare.pid
|
||||||
|
echo " Done."
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ "$1" == "stop" ]]; then
|
||||||
|
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
|
||||||
|
echo "SparkleShare isn't running."
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ "$1" == "restart" ]]; then
|
||||||
|
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
|
||||||
|
echo "SparkleShare isn't running."
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -e "/tmp/sparkleshare/sparkleshare.pid" ]; then
|
||||||
|
echo "SparkleShare is already running."
|
||||||
|
else
|
||||||
|
echo -n "Starting SparkleShare..."
|
||||||
|
|
||||||
|
# Start SparkleShare in the background and save the pid
|
||||||
|
mono "@expanded_libdir@/@PACKAGE@/SparkleShare.exe" $2 &
|
||||||
|
PID=$!
|
||||||
|
echo $PID > /tmp/sparkleshare/sparkleshare.pid
|
||||||
|
echo " Done."
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ "$1" == "--help" ]]; then
|
||||||
|
mono "@expanded_libdir@/@PACKAGE@/SparkleShare.exe" --help
|
||||||
|
fi
|
||||||
|
|
64
sparkleshare
64
sparkleshare
|
@ -1,64 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
|
|
||||||
pidfile=/tmp/sparkleshare/sparkleshare.pid
|
|
||||||
|
|
||||||
# Create a directory to save the pid to
|
|
||||||
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
|
|
||||||
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
|
|
||||||
echo "SparkleShare isn't running."
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [[ "$1" == "restart" ]]; then
|
|
||||||
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
|
|
||||||
echo "SparkleShare isn't running."
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ -e "/tmp/sparkleshare/sparkleshare.pid" ]; then
|
|
||||||
echo "SparkleShare is already running."
|
|
||||||
else
|
|
||||||
echo -n "Starting 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
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [[ "$1" == "--help" ]]; then
|
|
||||||
mono /usr/local/share/sparkleshare/SparkleShare.exe --help
|
|
||||||
fi
|
|
Loading…
Reference in a new issue