| 1 |
#!/bin/sh |
| 2 |
set -eu |
| 3 |
|
| 4 |
### BEGIN INIT INFO |
| 5 |
# Provides: netconsole |
| 6 |
# Required-Start: $named $network $local_fs $remote_fs |
| 7 |
# Required-Stop: $named $network $local_fs $remote_fs |
| 8 |
# Default-Start: 2 3 4 5 |
| 9 |
# Default-Stop: 0 1 6 |
| 10 |
# Short-Description: Dynamically configure Linux netconsole |
| 11 |
### END INIT INFO |
| 12 |
|
| 13 |
NAME=netconsole |
| 14 |
DAEMON=/usr/sbin/netconsole-setup |
| 15 |
|
| 16 |
# Exit if the package is not installed |
| 17 |
test -x $DAEMON || exit 0 |
| 18 |
|
| 19 |
. /lib/lsb/init-functions |
| 20 |
|
| 21 |
# Read configuration variable file if it is present |
| 22 |
NETCONSOLE_OPTS= |
| 23 |
if test -r /etc/default/$NAME; then |
| 24 |
. /etc/default/$NAME |
| 25 |
fi |
| 26 |
|
| 27 |
case "$1" in |
| 28 |
start|restart|force-reload) |
| 29 |
# shellcheck disable=SC2086 |
| 30 |
$DAEMON $NETCONSOLE_OPTS |
| 31 |
;; |
| 32 |
status|stop) |
| 33 |
# Nothing to do |
| 34 |
exit 0 |
| 35 |
;; |
| 36 |
*) |
| 37 |
echo "Usage: /etc/init.d/$NAME {start|stop|restart|force-reload}" >&2 |
| 38 |
exit 2 |
| 39 |
;; |
| 40 |
esac |