diff options
author | Yu Ke <ke.yu@intel.com> | 2010-08-27 10:10:52 +0800 |
---|---|---|
committer | Richard Purdie <rpurdie@linux.intel.com> | 2010-09-02 09:50:48 +0100 |
commit | df894c658d9df87b0b04fbb494d46d8eff0fd497 (patch) | |
tree | 716c831f92e4ac7f27d5d19c49ff928933760e56 /meta/recipes-extended/sysklogd/files | |
parent | 8cbf96aeaf10182e97f5180d22eaf969f968202e (diff) | |
download | openembedded-core-df894c658d9df87b0b04fbb494d46d8eff0fd497.tar.gz openembedded-core-df894c658d9df87b0b04fbb494d46d8eff0fd497.tar.bz2 openembedded-core-df894c658d9df87b0b04fbb494d46d8eff0fd497.tar.xz openembedded-core-df894c658d9df87b0b04fbb494d46d8eff0fd497.zip |
sysklogd: add sysklogd 1.5
sysklogd implements two system log daemons: syslogd, klogd.
this commit adds sysklogd 1.5. it is ported from OE with some cleanup.
sysklogd: move to recipes-extended
Signed-off-by: Yu Ke <ke.yu@intel.com>
Signed-off-by: Saul Wold <Saul.Wold@intel.com>
Diffstat (limited to 'meta/recipes-extended/sysklogd/files')
-rw-r--r-- | meta/recipes-extended/sysklogd/files/no-strip-install.patch | 15 | ||||
-rwxr-xr-x | meta/recipes-extended/sysklogd/files/sysklogd | 140 |
2 files changed, 155 insertions, 0 deletions
diff --git a/meta/recipes-extended/sysklogd/files/no-strip-install.patch b/meta/recipes-extended/sysklogd/files/no-strip-install.patch new file mode 100644 index 000000000..5a78f0173 --- /dev/null +++ b/meta/recipes-extended/sysklogd/files/no-strip-install.patch @@ -0,0 +1,15 @@ +Index: sysklogd-1.5/Makefile +=================================================================== +--- sysklogd-1.5.orig/Makefile 2009-06-09 13:02:41.000000000 +0200 ++++ sysklogd-1.5/Makefile 2009-06-09 13:03:06.000000000 +0200 +@@ -127,8 +127,8 @@ + rm -f syslogd klogd ksym syslog_tst oops_test TAGS tsyslogd tklogd + + install_exec: syslogd klogd +- ${INSTALL} -m 500 -s syslogd ${BINDIR}/syslogd +- ${INSTALL} -m 500 -s klogd ${BINDIR}/klogd ++ ${INSTALL} -m 500 syslogd ${BINDIR}/syslogd ++ ${INSTALL} -m 500 klogd ${BINDIR}/klogd + + install_man: + ${INSTALL} -m ${MAN_PERMS} sysklogd.8 ${MANDIR}/man8/sysklogd.8 diff --git a/meta/recipes-extended/sysklogd/files/sysklogd b/meta/recipes-extended/sysklogd/files/sysklogd new file mode 100755 index 000000000..e0fa7a8e1 --- /dev/null +++ b/meta/recipes-extended/sysklogd/files/sysklogd @@ -0,0 +1,140 @@ +#! /bin/sh +# /etc/init.d/sysklogd: start the system log daemon. + +### BEGIN INIT INFO +# Provides: sysklogd +# Required-Start: $remote_fs $time +# Required-Stop: $remote_fs $time +# Should-Start: $network +# Should-Stop: $network +# Default-Start: 2 3 4 5 +# Default-Stop: 0 1 6 +# Short-Description: System logger +### END INIT INFO + +PATH=/bin:/usr/bin:/sbin:/usr/sbin + +pidfile_syslogd=/var/run/syslogd.pid +pidfile_klogd=/var/run/syslogd.pid +binpath_syslogd=/sbin/syslogd +binpath_klogd=/sbin/klogd + +test -x $binpath || exit 0 + +test ! -r /etc/default/syslogd || . /etc/default/syslogd + +create_xconsole() +{ + # Only proceed if /dev/xconsole is used at all + if ! grep -q '^[^#].*/dev/xconsole' /etc/syslog.conf + then + return + fi + + if [ ! -e /dev/xconsole ]; then + mknod -m 640 /dev/xconsole p + else + chmod 0640 /dev/xconsole + fi + chown root:adm /dev/xconsole + test ! -x /sbin/restorecon || /sbin/restorecon /dev/xconsole +} + +log_begin_msg () { + echo -n $1 +} + +log_end_msg () { + echo $1 +} + +log_success_msg () { + echo $1 +} + +running() +{ + # No pidfile, probably no daemon present + # + if [ ! -f $pidfile ] + then + return 1 + fi + + pid=`cat $pidfile_syslogd` + + # No pid, probably no daemon present + # + if [ -z "$pid" ] + then + return 1 + fi + + if [ ! -d /proc/$pid ] + then + return 1 + fi + + cmd=`cat /proc/$pid/cmdline | tr "\000" "\n"|head -n 1` + + # No syslogd? + # + if [ "$cmd" != "$binpath" ] + then + return 1 + fi + + return 0 +} + +case "$1" in + start) + log_begin_msg "Starting system log daemon..." + create_xconsole + start-stop-daemon --start --quiet --pidfile $pidfile_syslogd --name syslogd --startas $binpath_syslogd -- $SYSLOGD + log_end_msg $? + log_begin_msg "Starting kernel log daemon..." + start-stop-daemon --start --quiet --pidfile $pidfile_klogd --name klogd --startas $binpath_klogd -- $KLOGD + log_end_msg $? + ;; + stop) + log_begin_msg "Stopping system log daemon..." + start-stop-daemon --stop --quiet --pidfile $pidfile_syslogd --name syslogd + log_end_msg $? + log_begin_msg "Stopping kernel log daemon..." + start-stop-daemon --stop --quiet --retry 3 --exec $binpath_klogd --pidfile $pidfile_klogd + log_end_msg $? + ;; + reload|force-reload) + log_begin_msg "Reloading system log daemon..." + start-stop-daemon --stop --quiet --signal 1 --pidfile $pidfile_syslogd --name syslogd + log_end_msg $? + log_begin_msg "Reloading kernel log daemon..." + start-stop-daemon --stop --quiet --retry 3 --exec $binpath_klogd --pidfile $pidfile_klogd + start-stop-daemon --start --quiet --pidfile $pidfile_klogd --name klogd --startas $binpath_klogd -- $KLOGD + log_end_msg $? + ;; + restart) + log_begin_msg "Restarting system log daemon..." + start-stop-daemon --stop --retry 5 --quiet --pidfile $pidfile_syslogd --name syslogd + start-stop-daemon --start --quiet --pidfile $pidfile_syslogd --name syslogd --startas $binpath_syslogd -- $SYSLOGD + log_end_msg $? + log_begin_msg "Reloading kernel log daemon..." + start-stop-daemon --stop --quiet --retry 3 --exec $binpath_klogd --pidfile $pidfile_klogd + start-stop-daemon --start --quiet --pidfile $pidfile_klogd --name klogd --startas $binpath_klogd -- $KLOGD + log_end_msg $? + ;; + reload-or-restart) + if running + then + $0 reload + else + $0 start + fi + ;; + *) + log_success_msg "Usage: /etc/init.d/sysklogd {start|stop|reload|restart|force-reload|reload-or-restart}" + exit 1 +esac + +exit 0 |