diff options
| author | Carlo Lanmdeter <clandmeter@gmail> | 2009-03-05 14:48:30 +0000 |
|---|---|---|
| committer | Carlo Lanmdeter <clandmeter@gmail> | 2009-03-05 14:48:30 +0000 |
| commit | df930dbd9fb00c1c381229a2c5ce68d82eaa53eb (patch) | |
| tree | a90740e8ab2134ad00ecf6ae8b205ec9f7c4990f /extra/tinyproxy/tinyproxy.initd | |
| parent | 87f8eb8ec3fad06f3d1ab02fc4aa36e4143c3baa (diff) | |
| parent | 739bdededdec7f411de9223fe440fc8141afe80b (diff) | |
| download | aports-df930dbd9fb00c1c381229a2c5ce68d82eaa53eb.tar.bz2 aports-df930dbd9fb00c1c381229a2c5ce68d82eaa53eb.tar.xz | |
Merge commit 'ncopa/master'
Diffstat (limited to 'extra/tinyproxy/tinyproxy.initd')
| -rw-r--r-- | extra/tinyproxy/tinyproxy.initd | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/extra/tinyproxy/tinyproxy.initd b/extra/tinyproxy/tinyproxy.initd new file mode 100644 index 0000000000..bee5d041fb --- /dev/null +++ b/extra/tinyproxy/tinyproxy.initd @@ -0,0 +1,45 @@ +#!/sbin/runscript +# Copyright 1999-2004 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/net-proxy/tinyproxy/files/tinyproxy.initd,v 1.1 2008/02/16 07:11:25 mrness Exp $ + +CONFFILE="/etc/tinyproxy/${SVCNAME}.conf" + +depend() { + use logger dns + need net +} + +checkconfig() { + if [ ! -f "${CONFFILE}" ]; then + eerror "Configuration file ${CONFFILE} not found!" + return 1 + fi + + PIDFILE=$(sed -n -e 's/^[[:space:]]*PidFile[[:space:]]\+"\(.*\)"[[:space:]]*$/\1/p' "${CONFFILE}") + return 0 +} + +start() { + checkconfig || return 1 + + ebegin "Starting tinyproxy" + if [ -n "${PIDFILE}" ]; then + start-stop-daemon --start --pidfile "${PIDFILE}" --startas /usr/sbin/tinyproxy -- -c "${CONFFILE}" + else + start-stop-daemon --start --exec /usr/sbin/tinyproxy -- -c "${CONFFILE}" + fi + eend $? +} + +stop() { + checkconfig || return 1 + + ebegin "Stopping tinyproxy" + if [ -n "${PIDFILE}" ]; then + start-stop-daemon --stop --pidfile "${PIDFILE}" + else + start-stop-daemon --stop --exec /usr/sbin/tinyproxy + fi + eend $? +} |
