summaryrefslogtreecommitdiffstats
path: root/main/sysklogd/sysklogd.initd
diff options
context:
space:
mode:
authorNatanael Copa <ncopa@alpinelinux.org>2009-07-24 08:01:31 +0000
committerNatanael Copa <ncopa@alpinelinux.org>2009-07-24 08:01:31 +0000
commitb70981b68efcce5256eb11c6cd26ae123b10b6ea (patch)
treea38be6efae5e2ba15c2e839504632f9b7bfd5f91 /main/sysklogd/sysklogd.initd
parent2b4df81538b8398442d5296650905c70341dd8d3 (diff)
downloadaports-b70981b68efcce5256eb11c6cd26ae123b10b6ea.tar.bz2
aports-b70981b68efcce5256eb11c6cd26ae123b10b6ea.tar.xz
moved extra/* to main/
and fixed misc build issues
Diffstat (limited to 'main/sysklogd/sysklogd.initd')
-rw-r--r--main/sysklogd/sysklogd.initd79
1 files changed, 79 insertions, 0 deletions
diff --git a/main/sysklogd/sysklogd.initd b/main/sysklogd/sysklogd.initd
new file mode 100644
index 000000000..59db00fc9
--- /dev/null
+++ b/main/sysklogd/sysklogd.initd
@@ -0,0 +1,79 @@
+#!/sbin/runscript
+# Copyright 1999-2005 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License, v2 or later
+# $Header: /var/cvsroot/gentoo-x86/app-admin/sysklogd/files/sysklogd.rc6,v 1.12 2007/05/01 12:49:04 uberlord Exp $
+
+opts="reload"
+
+depend() {
+ need clock hostname cron
+ provide logger
+}
+
+start_daemon() {
+ local retval=0
+ local daemon="$1"
+ local options="$2"
+
+ [ -z "${daemon}" ] && return 1
+
+ ebegin "sysklogd -> start: ${daemon}"
+ start-stop-daemon --start --exec /usr/sbin/"${daemon}" \
+ --pidfile /var/run/"${daemon}".pid -- ${options}
+ retval=$?
+ eend ${retval} "Failed to start ${daemon}"
+
+ return ${retval}
+}
+
+stop_daemon() {
+ local retval=0
+ local daemon="$1"
+
+ [ -z "${daemon}" ] && return 1
+
+ ebegin "sysklogd -> stop: ${daemon}"
+ # syslogd can be stubborn some times (--retry 15)...
+ start-stop-daemon --stop --retry 15 --quiet --pidfile /var/run/"${daemon}".pid
+ retval=$?
+ eend ${retval} "Failed to stop ${daemon}"
+
+ return ${retval}
+}
+
+start() {
+ start_daemon "syslogd" "${SYSLOGD}" || return 1
+
+ # vservers should not start klogd
+ [ "$RC_SYS" = "VSERVER" ] && return 0
+ # klogd do not always start proper if started too early
+ sleep 1
+
+ if ! start_daemon "klogd" "${KLOGD}" ; then
+ stop_daemon "syslogd"
+ return 1
+ fi
+
+ return 0
+}
+
+stop() {
+ if [ "$RC_SYS" != "VSERVER" ]; then
+ stop_daemon "klogd" || return 1
+ fi
+ stop_daemon "syslogd" || return 1
+ return 0
+}
+
+reload() {
+ local ret=0
+
+ ebegin "Reloading configuration"
+
+ start-stop-daemon --stop --oknodo --signal HUP --pidfile /var/run/syslogd.pid
+ ret=$((${ret} + $?))
+ start-stop-daemon --stop --oknodo --signal USR1 --pidfile /var/run/klogd.pid
+ ret=$((${ret} + $?))
+
+ eend ${ret}
+}