diff options
Diffstat (limited to 'www-misc/vdradmin-am/files/vdradmin-3.6.6.init')
-rw-r--r-- | www-misc/vdradmin-am/files/vdradmin-3.6.6.init | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/www-misc/vdradmin-am/files/vdradmin-3.6.6.init b/www-misc/vdradmin-am/files/vdradmin-3.6.6.init new file mode 100644 index 000000000000..2d689c803ca9 --- /dev/null +++ b/www-misc/vdradmin-am/files/vdradmin-3.6.6.init @@ -0,0 +1,54 @@ +#!/sbin/runscript +# Copyright 1999-2003 Gentoo Technologies, Inc. +# Distributed under the terms of the GNU General Public License, v2 or later +# $Header: /var/cvsroot/gentoo-x86/www-misc/vdradmin-am/files/vdradmin-3.6.6.init,v 1.1 2010/03/16 17:18:47 billie Exp $ + +depend() { + use vdr +} + +start() { + ebegin "Starting vdradmin" + + : ${VDRADMIN_USER:=vdradmin} + + local vdradmin_opts + if [ "${SSL}" = "yes" ]; then vdradmin_opts="${vdradmin_opts} --ssl"; fi + if [ "${IPV6}" = "yes" ]; then vdradmin_opts="${vdradmin_opts} --ipv6"; fi + vdradmin_opts="${vdradmin_opts} --log ${LOGLEVEL:=4}" + + if [ "${LOGGING}" = "syslog" ]; then + sed -i -e "/LOGGING/s-LOGGING.*-LOGGING = 1-" /etc/vdradmin/vdradmind.conf + sed -i -e "/LOGFILE/s-LOGFILE.*-LOGFILE = syslog-" /etc/vdradmin/vdradmind.conf + elif [ "${LOGGING}" = "file" ]; then + local logfile=/var/log/vdradmin/vdradmind.log + sed -i -e "/LOGGING/s-LOGGING.*-LOGGING = 1-" /etc/vdradmin/vdradmind.conf + sed -i -e "/LOGFILE/s-LOGFILE.*-LOGFILE = vdradmind.log-" /etc/vdradmin/vdradmind.conf + if [ ! -e ${logfile} ] ; then touch ${logfile}; fi + else + sed -i -e "/LOGGING/s-LOGGING.*-LOGGING = 0-" /etc/vdradmin/vdradmind.conf + fi + + # Guarantee that vdradmin can access its dirs + chown -R "${VDRADMIN_USER}:vdradmin" /var/cache/vdradmin + chown -R "${VDRADMIN_USER}:vdradmin" /var/log/vdradmin + chown -R "${VDRADMIN_USER}:vdradmin" /var/run/vdradmin + chown -R "${VDRADMIN_USER}:vdradmin" /etc/vdradmin + + if [ -x /etc/init.d/root ]; then + # running on baselayout-2/openrc + start-stop-daemon --start --background --user "${VDRADMIN_USER}" \ + --pidfile /var/run/vdradmin/vdradmind.pid \ + --exec /usr/bin/perl /usr/bin/vdradmind -- ${vdradmin_opts} + else + start-stop-daemon --start --background --chuid "${VDRADMIN_USER}" \ + --exec /usr/bin/vdradmind -- ${vdradmin_opts} + fi + eend $? +} + +stop() { + ebegin "Stopping vdradmin" + start-stop-daemon --stop --quiet --pidfile /var/run/vdradmin/vdradmind.pid + eend $? +} |