Skip to content

Instantly share code, notes, and snippets.

@centminmod
Last active August 29, 2015 13:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save centminmod/8997353 to your computer and use it in GitHub Desktop.
Save centminmod/8997353 to your computer and use it in GitHub Desktop.
btsync init.d for CentminMod.com installations
#! /bin/sh
##########################################
# /etc/init.d/btsync
# btsync init.d for CentminMod.com installs
##########################################
DEBUG='n'
##########################################
SERVICE=btsync
BITDIR='/usr/bin'
##########################################
stop(){
PIDCHECK=$(ps aufx | grep "${BITDIR}/btsync" | grep -v grep)
if [[ "$DEBUG" == [yY] ]]; then
echo $PIDCHECK
fi
if [[ ! -z "$PIDCHECK" ]]; then
PIDBS=$(pidof btsync)
#killall btsync
if [[ "$DEBUG" == [yY] ]]; then
echo "kill -9 $PIDBS"
fi
kill -9 $PIDBS
echo "$SERVICE stopped"
fi
}
start() {
${BITDIR}/btsync
echo "$SERVICE started"
}
###########################################
case "$1" in
start)
start
;;
stop)
stop
;;
restart)
stop
start
;;
*)
echo "Usage: /etc/init.d/btsync {start|stop|restart}"
exit 1
;;
esac
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment