Last active
August 29, 2015 14:09
-
-
Save yohangdev/8b81b5867848f14eaba1 to your computer and use it in GitHub Desktop.
utorrent server auto start / as service
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 | |
# Quick start-stop-daemon example, derived from Debian /etc/init.d/ssh | |
set -e | |
# Must be a valid filename | |
NAME=utserver | |
PIDFILE=/var/run/$NAME.pid | |
#This is the command to be run, give the full pathname | |
DAEMON=/home/javan/utorrent/utserver | |
DAEMON_OPTS="-daemon -settingspath /home/javan/utorrent/ -pidfile /var/run/utserver.pid -logfile /home/javan/utorrent/log.log" | |
export PATH="${PATH:+$PATH:}/usr/sbin:/sbin" | |
case "$1" in | |
start) | |
echo -n "Starting daemon: "$NAME | |
start-stop-daemon --start --quiet --chuid javan --pidfile $PIDFILE --exec $DAEMON -- $DAEMON_OPTS | |
echo "." | |
;; | |
stop) | |
echo -n "Stopping daemon: "$NAME | |
start-stop-daemon --stop --quiet --oknodo --pidfile $PIDFILE | |
echo "." | |
;; | |
restart) | |
echo -n "Restarting daemon: "$NAME | |
start-stop-daemon --stop --quiet --oknodo --retry 30 --pidfile $PIDFILE | |
start-stop-daemon --start --quiet --chuid javan --pidfile $PIDFILE --exec $DAEMON -- $DAEMON_OPTS | |
echo "." | |
;; | |
*) | |
echo "Usage: "$1" {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