Skip to content

Instantly share code, notes, and snippets.

@afroald
Last active December 23, 2015 01:48
Show Gist options
  • Save afroald/6562349 to your computer and use it in GitHub Desktop.
Save afroald/6562349 to your computer and use it in GitHub Desktop.
init.d script for BitTorrent Sync
#! /bin/sh
# /etc/init.d/btsync
#
DAEMON=/etc/btsync/btsync
CONFIG=/etc/btsync/sync.conf
start() {
$DAEMON --config $CONFIG
}
stop() {
pkill btsync
}
status() {
dbpid=`pgrep -f $DAEMON`
if [ -z "$dbpid" ]; then
echo "btsync: not running."
else
echo "btsync: running (pid $dbpid)"
fi
}
case "$1" in
start)
start
;;
stop)
stop
;;
restart|reload|force-reload)
stop
start
;;
status)
status
;;
*)
echo "Usage: /etc/init.d/btsync {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