Skip to content

Commit 46cf029

Browse files
authored
Added rsyslog serivce management without the need for systemd (#113)
This enables support for managing the rsyslog service within containers without the need for systemd: start - start rsyslog stop - terminate rsyslog restart - terminate and start rsyslog reload - reload rsyslog status - report rsyslog status
2 parents 438b3c7 + 97f539c commit 46cf029

File tree

3 files changed

+102
-0
lines changed

3 files changed

+102
-0
lines changed

Dockerfile.rocky8

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1712,6 +1712,7 @@ ADD apache-init-helper /etc/init.d/apache-minimal
17121712
# NOTE: inherit explicit LANG set above for apache and migrid services
17131713
RUN sed "s/#LANG=.*/LANG=${LANG}/g" /app/migrid-httpd-init.sh > /etc/sysconfig/apache-minimal
17141714
RUN grep LANG /etc/sysconfig/apache-minimal > /etc/sysconfig/migrid
1715+
ADD rsyslog-init-helper /etc/init.d/rsyslog-minimal
17151716
RUN chown $USER:$GROUP /app/docker-entry.sh \
17161717
&& chmod +x /app/docker-entry.sh
17171718

Dockerfile.rocky9

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1586,6 +1586,7 @@ ADD apache-init-helper /etc/init.d/apache-minimal
15861586
# NOTE: inherit explicit LANG set above for apache and migrid services
15871587
RUN sed "s/#LANG=.*/LANG=${LANG}/g" /app/migrid-httpd-init.sh > /etc/sysconfig/apache-minimal
15881588
RUN grep LANG /etc/sysconfig/apache-minimal > /etc/sysconfig/migrid
1589+
ADD rsyslog-init-helper /etc/init.d/rsyslog-minimal
15891590
RUN chown $USER:$GROUP /app/docker-entry.sh \
15901591
&& chmod +x /app/docker-entry.sh
15911592

rsyslog-init-helper

Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
#!/bin/bash
2+
#
3+
# /etc/rc.d/init.d/rsyslog-minimal
4+
#
5+
# A simple rsyslog wrapper for docker-migrid container use
6+
#
7+
# Recognized arguments:
8+
# start - start rsyslog
9+
# stop - terminate rsyslog
10+
# restart - terminate and start rsyslog
11+
# reload - reload rsyslog
12+
# status - report rsyslog status
13+
#
14+
# Customization of the rsyslog installation should be specified by
15+
# variables in /etc/sysconfig/rsyslog-minimal
16+
#
17+
# Made from the template /usr/share/doc/initscripts-X/sysinitvfiles
18+
# from our CentOS installation
19+
#
20+
# <tags ...>
21+
#
22+
# chkconfig: - 90 10
23+
# description: rsyslogd - reliable and extended syslogd
24+
# processname: rsyslogd
25+
# config: /etc/sysconfig/rsyslog-minimal
26+
#
27+
28+
# Source function library.
29+
. /etc/init.d/functions
30+
31+
# <define any local shell functions used by the code that follows>
32+
33+
# first, pull in custom configuration (if it exists):
34+
if [ -f /etc/sysconfig/rsyslog-minimal ]; then
35+
. /etc/sysconfig/rsyslog-minimal
36+
fi
37+
# you probably do not want to modify these...
38+
PID_DIR="${PID_DIR:-/var/run}"
39+
DAEMON_PATH="/usr/sbin/rsyslogd"
40+
PID_FILE="$PID_DIR/rsyslogd.pid"
41+
42+
show_usage() {
43+
echo "Usage: rsyslog-minimal {start|stop|status|restart|reload}"
44+
}
45+
46+
start_rsyslog() {
47+
echo -n "Starting rsyslog daemon"
48+
${DAEMON_PATH}
49+
RET2=$?
50+
[ $RET2 ] && success
51+
echo
52+
[ $RET2 ] || echo "Warning: rsyslog daemon not started."
53+
echo
54+
}
55+
56+
stop_rsyslog() {
57+
echo -n "Shutting down rsyslog daemon"
58+
killproc ${DAEMON_PATH}
59+
echo
60+
}
61+
62+
reload_rsyslog() {
63+
echo -n "Reloading rsyslog daemon"
64+
killproc ${DAEMON_PATH} -HUP
65+
echo
66+
}
67+
68+
status_rsyslog() {
69+
status ${DAEMON_PATH}
70+
}
71+
72+
73+
### Main ###
74+
75+
# Exit cleanly if main daemon is missing
76+
test -f ${DAEMON_PATH} || exit 0
77+
78+
case "$1" in
79+
start)
80+
start_rsyslog
81+
;;
82+
stop)
83+
stop_rsyslog
84+
;;
85+
status)
86+
status_rsyslog
87+
;;
88+
restart)
89+
stop_rsyslog
90+
start_rsyslog
91+
;;
92+
reload)
93+
reload_rsyslog
94+
;;
95+
*)
96+
show_usage
97+
exit 1
98+
;;
99+
esac
100+
exit $?

0 commit comments

Comments
 (0)