54 lines
995 B
Bash
Executable File
54 lines
995 B
Bash
Executable File
#!/bin/sh
|
|
### BEGIN INIT INFO
|
|
# Provides: motd
|
|
# Required-Start: hostname $local_fs
|
|
# Required-Stop:
|
|
# Should-Start:
|
|
# Default-Start: 1 2 3 4 5
|
|
# Default-Stop:
|
|
# Short-Description: Create dynamic part of /etc/motd
|
|
# Description: /etc/motd is user-editable and static. This script
|
|
# creates the initial dynamic part, by default the
|
|
# output of uname, and stores it in /var/run/motd.dynamic.
|
|
# Both parts are output by pam_motd.
|
|
### END INIT INFO
|
|
|
|
PATH=/sbin:/usr/sbin:/bin:/usr/bin
|
|
. /lib/init/vars.sh
|
|
|
|
do_start () {
|
|
# Update motd
|
|
uname -snrvm > /var/run/motd.dynamic
|
|
}
|
|
|
|
do_status () {
|
|
if [ -f /var/run/motd.dynamic ] ; then
|
|
return 0
|
|
else
|
|
return 4
|
|
fi
|
|
}
|
|
|
|
case "$1" in
|
|
start|"")
|
|
do_start
|
|
;;
|
|
restart|reload|force-reload)
|
|
echo "Error: argument '$1' not supported" >&2
|
|
exit 3
|
|
;;
|
|
stop)
|
|
# No-op
|
|
;;
|
|
status)
|
|
do_status
|
|
exit $?
|
|
;;
|
|
*)
|
|
echo "Usage: motd [start|stop|status]" >&2
|
|
exit 3
|
|
;;
|
|
esac
|
|
|
|
:
|