From 246c02013c1e1840e0e3e333157981c82b7d620a Mon Sep 17 00:00:00 2001 From: Michael Mason Date: Tue, 24 Feb 2009 03:04:18 +0000 Subject: extra/tinyproxy Initial commit of file --- extra/tinyproxy/tinyproxy.initd | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 extra/tinyproxy/tinyproxy.initd (limited to 'extra/tinyproxy/tinyproxy.initd') diff --git a/extra/tinyproxy/tinyproxy.initd b/extra/tinyproxy/tinyproxy.initd new file mode 100644 index 0000000000..980c53e72d --- /dev/null +++ b/extra/tinyproxy/tinyproxy.initd @@ -0,0 +1,39 @@ +#!/sbin/runscript + +# Sample init.d file for alpine linux. + +NAME= +DAEMON=/usr/sbin/$NAME + +depend() { + need net +} + +start() { + ebegin "Starting ${NAME}" + start-stop-daemon --start --quiet --background \ + --make-pidfile --pidfile /var/run/${NAME}.pid \ + --chuid ${USER}:${GROUP} \ + --exec ${DAEMON} -- ${OPTS} + eend $? +} + +stop() { + ebegin "Stopping ${NAME}" + start-stop-daemon --stop --quiet \ + --exec ${DAEMON} \ + --pidfile /var/run/${NAME}.pid \ + eend $? +} + +reload() { + ebegin "Reloading ${NAME}" + if ! service_started "${NAME}" ; then + eend 1 "${NAME} is not started" + return 1 + fi + start-stop-daemon --stop --oknodo --signal HUP \ + --exec ${DAEMON} --pidfile /var/run/${NAME}.pid + eend $? +} + -- cgit v1.2.3 From 2164218472c7e0e946931f050a927702c91a1454 Mon Sep 17 00:00:00 2001 From: Natanael Copa Date: Tue, 24 Feb 2009 10:21:10 +0000 Subject: 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 --- extra/tinyproxy/tinyproxy.initd | 52 +++++++++++++++++++++++------------------ 1 file changed, 29 insertions(+), 23 deletions(-) (limited to 'extra/tinyproxy/tinyproxy.initd') 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 $? } - -- cgit v1.2.3