aports/openrc/transmission/runfile

50 lines
1.6 KiB
Plaintext

#!/sbin/openrc-run
# Copyright 1999-2011 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/net-p2p/transmission/files/transmission-daemon.initd.8,v 1.2 2011/12/04 10:35:07 swegener Exp $
extra_started_commands="reload"
description="Transmission is a fast, easy and free bittorrent client"
description_start="Start transmission-daemon server and web interface"
description_stop="Stop transmission-daemon server and web interface"
description_reload="Reload transmission-daemon settings"
config_dir="${config_dir:-/var/lib/transmission/config}"
download_dir="${download_dir:-/var/lib/transmission/downloads}"
logfile="${logfile:-/var/log/transmission/transmission.log}"
rundir="${rundir:-/var/run/transmission}"
command="/usr/bin/transmission-daemon"
command_user="${command_user:-transmission:transmission}"
pidfile="${pidfile:-${rundir}/transmission.pid}"
command_args="--pid-file ${pidfile}"
depend() {
need net
after firewall
}
check_config() {
command_args="${command_args} --config-dir ${config_dir}"
if [ ! -f "${config_dir}/settings.json" ]; then
command_args="${command_args} --download-dir ${download_dir}"
fi
if [ -n "${logfile}" ]; then
command_args="${command_args} --logfile ${logfile}"
fi
}
start_pre() {
check_config
checkpath -d -m 750 -o "$command_user" "$download_dir" "$config_dir" "$config_dir/resume" "$rundir"
checkpath -f -m 440 -o "$command_user" "$config_dir"/settings.json
}
reload() {
ebegin "Reloading transmission configuration"
start-stop-daemon --signal HUP --pidfile ${pidfile}
eend $?
}