5 Commits

Author SHA1 Message Date
Jay Larson
a17524bbcf The following changes were made
* killproc in init script now properly uses PID files
  * pidofproc now checks PID files in init script
  * Will no longer attempt to start klogd if running in container
  * Updated default syslog.conf to prevent annoying 'noone' errors
  * Updated usher to use /bin/sh
  * Removed chroot from usher (will be performed by latest snap)
2017-12-02 16:51:21 -06:00
Jay Larson
9f9452db63 Removed quotes for chroot command in usher 2017-05-31 11:12:23 -05:00
Jay Larson
9a40963b05 The following changes were made:
* Updated /etc/default/sysklogd
  * Updated init script
2017-05-17 10:34:53 -05:00
Jay Larson
4e9f1aae29 Corrected permissions for etc/init.d/sysklogd 2017-05-05 17:21:42 -05:00
Jay Larson
3a84f67f3d The following changes were made:
* Added defaults file in usr/share/sysklogd (managed by usher)
  * Added init script
  * Added syslog.conf (managed by usher)
2017-05-05 17:17:45 -05:00
5 changed files with 140 additions and 14 deletions

View File

@@ -16,7 +16,7 @@ DESC = This package implements two system log daemons. The syslogd daemon \
is an enhanced version of the standard Berkeley utility program. The klogd \
daemon listens to kernel message sources and is responsible for prioritizing \
and processing operating system messages.
SNAPVER = 2
SNAPVER = 7
ARCHIVE := $(PWD)/SRC/$(shell ls SRC|egrep '(bz2|gz|tar|xz)$$'|tail -1)
TYPE := $(shell file -ib $(ARCHIVE)|cut -d';' -f1|tr -d '\n')
@@ -55,7 +55,15 @@ $(ROOT): $(SRCDIR)/syslogd
mkdir -v $(ROOT); \
fi
@cd $(SRCDIR) && make install DESTDIR=$(ROOT) BINDIR=/sbin
@cd $(SRCDIR) && make install DESTDIR=$(ROOT) BINDIR=/sbin && \
install -v -d -m 755 $(ROOT)/etc/{default,init.d} && \
install -v -d -m 755 $(ROOT)/usr/share/sysklogd && \
install -v -m 644 $(PWD)/SNAP/sysklogd.default \
$(ROOT)/usr/share/sysklogd/sysklogd.default && \
install -v -m 755 $(PWD)/SNAP/sysklogd.init \
$(ROOT)/etc/init.d/sysklogd && \
install -v -m 644 $(PWD)/SNAP/syslog.conf \
$(ROOT)/usr/share/sysklogd/syslog.conf
test: $(ROOT)
@cd $(SRCDIR); \

7
SNAP/sysklogd.default Normal file
View File

@@ -0,0 +1,7 @@
# Options for sysklogd
# Options for syslogd
SYSLOGD_OPTIONS="-m 0"
# Options for klogd
KLOGD_OPTINS="-c 1"

84
SNAP/sysklogd.init Executable file
View File

@@ -0,0 +1,84 @@
#!/bin/sh
### BEGIN INIT INFO
# Provides: $syslog
# Required-Start: $local_fs $network
# Required-Stop: $local_fs $network sendsignals
# Should-Start:
# Should-Stop:
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Starts kernel and system log daemons.
# X-Required: true
### END INIT INFO
SYSLOGD="/sbin/syslogd"
SPIDFILE="/var/run/syslogd.pid"
KLOGD="/sbin/klogd"
KPIDFILE="/var/run/klogd.pid"
. /lib/lsb/init-functions
[ -r /etc/default/sysklogd ] && . /etc/default/sysklogd
case "$1" in
start)
log_init_msg "Starting system log daemon"
start_daemon "$SYSLOGD" "$SYSLOGD_OPTIONS" && log_success_msg || \
log_failure_msg
if [ -z "$container" ]; then
log_init_msg "Starting kernel log daemon"
start_daemon "$KLOGD" "$KLOGD_OPTIONS" && log_success_msg || \
log_failure_msg
fi
;;
stop)
log_init_msg "Stopping system log daemon"
killproc -p "$SPIDFILE" "$SYSLOGD" && log_success_msg || log_failure_msg
if [ -z "$container" ]; then
log_init_msg "Stopping kernel log daemon"
killproc -p "$KPIDFILE" "$KLOGD" && log_success_msg || log_failure_msg
fi
;;
reload)
log_init_msg "Reloading system log daemon config file"
killproc -p "$SPIDFILE" "$SYSLOGD" -HUP && log_success_msg || \
log_failure_msg
if [ -z "$container" ]; then
killproc -p "$KPIDFILE" "$KLOGD" -USR2 && log_success_msg || \
log_failure_msg
fi
;;
restart)
$0 stop
sleep 1
$0 start
;;
status)
pid=$(pidofproc -p "$SPIDFILE" "$SYSLOGD");
if [ "$?" -ne 0 ]; then
echo "System log daemon is not runing"
else
echo "System log daemon running with PID: $pid"
fi
if [ -z "$container" ]; then
pid=$(pidofproc -p "$KPIDFILE" "$KLOGD");
if [ "$?" -ne 0 ]; then
echo "Kernel log daemon is not runing"
else
echo "Kernel log daemon running with PID: $pid"
fi
fi
;;
*)
echo "Usage: $0 [start|stop|reload|restart|status]"
exit 1
;;
esac
exit 0

27
SNAP/syslog.conf Normal file
View File

@@ -0,0 +1,27 @@
# Configuration for sysklogd
# Standard log files
auth,authpriv.* /var/log/auth.log
*.*;auth,authpriv.none -/var/log/syslog
daemon.* -/var/log/daemon.log
kern.* -/var/log/kern.log
lpr.* -/var/log/lpr.log
mail.* -/var/log/mail.log
user.* -/var/log/user.log
# Mail configuration
mail.info -/var/log/mail.info
mail.warn -/var/log/mail.warn
mail.err -/var/log/mail.err
# Catch all logs
*.=debug; \
auth,authpriv.none; \
news.none;mail.none -/var/log/debug
*.=info;*.=notice;*.=warn; \
auth,authpriv.none; \
cron,daemon.none; \
mail,news.none -/var/log/messages
# Logging of emergency messages
*.emerg -/var/log/kern.log

View File

@@ -1,24 +1,24 @@
#!/bin/bash
#!/bin/sh
set -e
CONF="auth,authpriv.* -/var/log/auth.log
*.*;auth,authpriv.none -/var/log/sys.log
daemon.* -/var/log/daemon.log
kern.* -/var/log/kern.log
mail.* -/var/log/mail.log
user.* -/var/log/user.log
#*.emerg *
*.emerg -/var/log/kern.log"
case $1 in
preinst)
exit 0
;;
postinst)
if [ ! -f ${TARGET}/etc/syslog.conf ]; then
echo "${CONF}" > ${TARGET}/etc/syslog.conf
if [ ! -f /etc/syslog.conf ]; then
install -m 644 /usr/share/sysklogd/syslog.conf /etc/syslog.conf
fi
if [ ! -f /etc/default/sysklogd ]; then
install -m 644 /usr/share/sysklogd/sysklogd.default /etc/default/sysklogd
fi
if [ -f /var/run/syslogd.pid ]; then
/etc/init.d/sysklogd restart
fi
update-rc enable sysklogd
;;
prerm)
exit 0