Last active
August 29, 2015 13:56
-
-
Save centminmod/8997353 to your computer and use it in GitHub Desktop.
btsync init.d for CentminMod.com installations
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/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