Skip to content

Instantly share code, notes, and snippets.

@tdebarochez
Created January 28, 2011 08:27
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 tdebarochez/799996 to your computer and use it in GitHub Desktop.
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
#!/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
@tdebarochez
Copy link
Author

Put this script in /etc/init.d/, run chmod +x on it and execute :
chkconfig --add transmission && chkconfig --level 2345 transmission on

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment