aboutsummaryrefslogtreecommitdiffstats
path: root/extra/tinyproxy/tinyproxy.initd
diff options
context:
space:
mode:
authorNatanael Copa <ncopa@alpinelinux.org>2009-02-24 10:21:10 +0000
committerNatanael Copa <ncopa@alpinelinux.org>2009-02-24 10:21:10 +0000
commit2164218472c7e0e946931f050a927702c91a1454 (patch)
treee0471434a70adefd19c77d421ef573ade209622d /extra/tinyproxy/tinyproxy.initd
parent246c02013c1e1840e0e3e333157981c82b7d620a (diff)
downloadaports-2164218472c7e0e946931f050a927702c91a1454.tar.bz2
aports-2164218472c7e0e946931f050a927702c91a1454.tar.xz
extra/tinyproxy: run as "tinyproxy" by default. fixed it so it works
- run sed to set correct user, group and pidfile in default config - copied init.d script from gentoo - killed unused conf.d file. - fix installscript to create user and set perms to pidfile dir - actually install the init.d script
Diffstat (limited to 'extra/tinyproxy/tinyproxy.initd')
-rw-r--r--extra/tinyproxy/tinyproxy.initd52
1 files changed, 29 insertions, 23 deletions
diff --git a/extra/tinyproxy/tinyproxy.initd b/extra/tinyproxy/tinyproxy.initd
index 980c53e72d..bee5d041fb 100644
--- a/extra/tinyproxy/tinyproxy.initd
+++ b/extra/tinyproxy/tinyproxy.initd
@@ -1,39 +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 $
-# Sample init.d file for alpine linux.
-
-NAME=
-DAEMON=/usr/sbin/$NAME
+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() {
- ebegin "Starting ${NAME}"
- start-stop-daemon --start --quiet --background \
- --make-pidfile --pidfile /var/run/${NAME}.pid \
- --chuid ${USER}:${GROUP} \
- --exec ${DAEMON} -- ${OPTS}
+ 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() {
- ebegin "Stopping ${NAME}"
- start-stop-daemon --stop --quiet \
- --exec ${DAEMON} \
- --pidfile /var/run/${NAME}.pid \
- eend $?
-}
+ checkconfig || return 1
-reload() {
- ebegin "Reloading ${NAME}"
- if ! service_started "${NAME}" ; then
- eend 1 "${NAME} is not started"
- 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
- start-stop-daemon --stop --oknodo --signal HUP \
- --exec ${DAEMON} --pidfile /var/run/${NAME}.pid
eend $?
}
-