| 1 |
#!/bin/sh |
| 2 |
### BEGIN INIT INFO |
| 3 |
# Provides: bootlogs |
| 4 |
# Required-Start: hostname $local_fs |
| 5 |
# Required-Stop: |
| 6 |
# Should-Start: $x-display-manager gdm kdm xdm ldm sdm wdm nodm |
| 7 |
# Default-Start: 1 2 3 4 5 |
| 8 |
# Default-Stop: |
| 9 |
# Short-Description: Log file handling to be done during bootup. |
| 10 |
# Description: Various things that don't need to be done particularly |
| 11 |
# early in the boot, just before getty is run. |
| 12 |
### END INIT INFO |
| 13 |
|
| 14 |
PATH=/usr/sbin:/usr/bin:/sbin:/bin |
| 15 |
[ "$DELAYLOGIN" ] || DELAYLOGIN=yes |
| 16 |
. /lib/init/vars.sh |
| 17 |
|
| 18 |
do_start() { |
| 19 |
# If /var/log/dmesg exists, rotate it, otherwise touch it with |
| 20 |
# reasonable default permsissions and ownership. |
| 21 |
# |
| 22 |
# savelog(8) preserves ownership and permissions, that were set by |
| 23 |
# local system administrator. |
| 24 |
if [ -f /var/log/dmesg ]; then |
| 25 |
savelog -q -p -c 5 /var/log/dmesg |
| 26 |
else |
| 27 |
touch /var/log/dmesg |
| 28 |
chown root:adm /var/log/dmesg |
| 29 |
chmod 640 /var/log/dmesg |
| 30 |
fi |
| 31 |
|
| 32 |
# Save kernel messages in /var/log/dmesg |
| 33 |
if which dmesg >/dev/null 2>&1; then |
| 34 |
dmesg -s 524288 >/var/log/dmesg |
| 35 |
elif [ -c /dev/klog ]; then |
| 36 |
dd if=/dev/klog of=/var/log/dmesg & |
| 37 |
sleep 1 |
| 38 |
kill $! |
| 39 |
fi |
| 40 |
} |
| 41 |
|
| 42 |
do_status() { |
| 43 |
return 0 |
| 44 |
} |
| 45 |
|
| 46 |
case "$1" in |
| 47 |
start | "") |
| 48 |
do_start |
| 49 |
;; |
| 50 |
restart | reload | force-reload) |
| 51 |
echo "Error: argument '$1' not supported" >&2 |
| 52 |
exit 3 |
| 53 |
;; |
| 54 |
stop) |
| 55 |
# No-op |
| 56 |
;; |
| 57 |
status) |
| 58 |
do_status |
| 59 |
exit $? |
| 60 |
;; |
| 61 |
*) |
| 62 |
echo "Usage: bootlogs [start|stop|status]" >&2 |
| 63 |
exit 3 |
| 64 |
;; |
| 65 |
esac |
| 66 |
|
| 67 |
: |