#!/sbin/runscript # Copyright 1999-2008 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # $Header: $ # Change user and group user=apache group=apache # Name of the dir where .transmission, pid and socket will be located. # Best way is to use the filename of this file. name=clutch DIR=/var/clutch SPDIR=${DIR}/${name} PIDFILE=${SPDIR}/${name}.pid SOCKETFILE=${SPDIR}/${name}.socket DAEMON=/usr/bin/transmission-daemon depend() { need net } start() { ebegin "Starting clutch" if [ ! -d ${DIR} ]; then mkdir ${DIR} fi if [ ! -d ${SPDIR} ]; then mkdir ${SPDIR} chown ${user}:${group} ${SPDIR} fi start-stop-daemon --start --chuid ${user} --env HOME=${SPDIR} \ --pidfile ${PIDFILE} --exec ${DAEMON} -- \ --pidfile ${PIDFILE} --socket ${SOCKETFILE} eend $? } stop() { ebegin "Stopping clutch" start-stop-daemon --stop --pidfile ${PIDFILE} --exec ${DAEMON} eend $? }