Created
January 28, 2011 08:27
-
-
Save tdebarochez/799996 to your computer and use it in GitHub Desktop.
This shell script takes care of starting and stopping transmission daemon on Openfiler distro
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 | |
# | |
# Created 2011-01-18 by tdebarochez | |
# | |
# transmission This shell script takes care of starting and stopping | |
# transmission daemon. | |
# | |
# chkconfig: - 90 10 | |
# description: transmission is a daemon for a bittorent client | |
# processname: transmission | |
# Source function library | |
if [ -f /etc/init.d/functions ]; then | |
. /etc/init.d/functions | |
elif [ -f /etc/rc.d/functions ]; then | |
. /etc/rc.d/functions | |
fi | |
BIN=/usr/local/bin/transmission-daemon | |
LOCKFILE=/var/lock/subsys/transmission | |
USER=transmission | |
ARGS="--log-info -e /var/log/transmission.log --config-dir /opt/config/transmission-daemon/" | |
# See how we were called. | |
case "$1" in | |
start) | |
# Start daemons. | |
echo -n "Starting transmission : " | |
daemon --user $USER $BIN $ARGS 2> /dev/null | |
echo | |
touch $LOCKFILE | |
;; | |
stop) | |
# Stop daemons. | |
echo -n "Shutting down transmission : " | |
killproc $BIN | |
echo | |
rm -f $LOCKFILE | |
;; | |
restart) | |
$0 stop | |
$0 start | |
;; | |
status) | |
status $BIN | |
;; | |
reload) | |
[ ! -f $LOCKFILE ] && echo "transmission daemon is not running" && exit 1 | |
echo -n "Reloading transmission : " | |
killall -HUP "`basename $BIN`" | |
[ "$?" -ne "0" ] && failure "transmission reload" && echo && exit 1 | |
success "transmission successfully reloaded" | |
echo | |
;; | |
*) | |
echo "Usage: service ransmission {start|stop|restart|status|reload}" | |
exit 1 | |
esac | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Put this script in
/etc/init.d/
, runchmod +x
on it and execute :chkconfig --add transmission && chkconfig --level 2345 transmission on