-
-
Save bsmithyman/224efc5e34ca05347d4a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# /etc/init.d/SpiderOak | |
### BEGIN INIT INFO | |
# Provides: SpiderOsk | |
# Required-Start: $network $syslog $remote_fs | |
# Required-Stop: $network $syslog $remote_fs | |
# Should-Start: $named $time | |
# Should-Stop: $named $time | |
# Default-Start: 2 3 4 5 | |
# Default-Stop: 0 1 6 | |
# Short-Description: Start and stop the SpiderOak daemon for debian/ubuntu | |
# Description: SpiderOsk daemon for linux | |
### END INIT INFO | |
SPIDEROAK_USERS="userA userB" | |
ARGS="--headless" | |
start() { | |
echo "Starting SpiderOak..." | |
for dbuser in $SPIDEROAK_USERS; do | |
start-stop-daemon -m -b -p "/var/run/SpiderOak.${dbuser}.pid" -b -o -c $dbuser -S -x /usr/bin/SpiderOak -- $ARGS | |
done | |
} | |
stop() { | |
echo "Stopping SpiderOak..." | |
for dbuser in $SPIDEROAK_USERS; do | |
start-stop-daemon -o -c $dbuser -K -p "/var/run/SpiderOak.${dbuser}.pid" | |
done | |
} | |
status() { | |
for dbuser in $SPIDEROAK_USERS; do | |
dbpid=`pgrep -u $dbuser SpiderOak` | |
if [ -z $dbpid ] ; then | |
echo "SpiderOak for USER $dbuser: not running." | |
else | |
echo "SpiderOak for USER $dbuser: running." | |
fi | |
done | |
} | |
case "$1" in | |
start) | |
start | |
;; | |
stop) | |
stop | |
;; | |
restart|reload|force-reload) | |
stop | |
start | |
;; | |
status) | |
status | |
;; | |
*) | |
echo "Usage: /etc/init.d/SpiderOak {start|stop|reload|force-reload|restart|status}" | |
exit 1 | |
esac | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment