mirror of
https://github.com/ceph/ceph
synced 2024-12-22 11:31:55 +00:00
1b2a0669b9
This puts in place an init script and a command it runs to save a kernel core dump to a remote server when a panic or other kernel failure occurs. The content of a crash file generated by the "kdump" init script (which uses the Ubuntu "apport" kernel_crashdump command) is re-packaged and copied (via scp) to a remote server specified by variables in /etc/default/ceph-kdump-copy. This packaging (as well as the work done by the apport script) is done on the next boot of the kernel following a crash. Note: Although the init script, its config file, and shell script are known to work, the packaging of these things should not be expected to be. I (now) know, for example, that the init script belongs in src/init-ceph-kdump-copy.in if it is to follow the pattern used by the ceph init script. And there are likely other problems with the build/install portions of this patch. Signed-off-by: Alex Elder <elder@dreamhost.com>
70 lines
1.9 KiB
Bash
70 lines
1.9 KiB
Bash
#! /bin/sh
|
|
### BEGIN INIT INFO
|
|
# Provides: ceph-kdump-copy
|
|
# Required-Start: $kdump
|
|
# Required-Stop:
|
|
# Default-Start: 2
|
|
# Default-Stop: 6
|
|
# Short-Description: Copies kdump crash files to remote server
|
|
# Description: This file is used to move crash files generated
|
|
# by Ubuntu apport via the kdump init script to a
|
|
# remote host.
|
|
### END INIT INFO
|
|
|
|
# Author: Alex Elder <elder@dreamhost.com>
|
|
|
|
# To install and activate this init script:
|
|
# update-rc.d ceph-kdump-copy start 02 2 .
|
|
# To deactivate and uninstall this init script:
|
|
# update-rc.d -f ceph-kdump-copy remove
|
|
|
|
# PATH should only include /usr/* if it runs after the mountnfs.sh script
|
|
PATH="/sbin:/usr/sbin:/bin:/usr/bin"
|
|
DESC="Copies kdump crash files to remote server"
|
|
NAME="ceph-kdump-copy"
|
|
SCRIPTNAME="/etc/init.d/${NAME}"
|
|
CONFIGFILE="/etc/default/${NAME}"
|
|
|
|
# Exit if the copy command is not installed
|
|
[ -x "/usr/bin/ceph-kdump-copy" ] || exit 0
|
|
|
|
# Read configuration variable file if it is present
|
|
[ -r "${CONFIGFILE}" ] && . "${CONFIGFILE}"
|
|
|
|
[ -z "${KDUMP_HOST}" ] &&
|
|
err "please specify KDUMP_HOST in '${CONFIGFILE}'"
|
|
[ -z "${KDUMP_HOST_USER}" ] &&
|
|
err "please specify KDUMP_HOST_USER in '${CONFIGFILE}'"
|
|
export KDUMP_HOST KDUMP_HOST_USER
|
|
|
|
# Load the VERBOSE setting and other rcS variables
|
|
. /lib/init/vars.sh
|
|
|
|
# Define LSB log_* functions.
|
|
# Depend on lsb-base (>= 3.2-14) to ensure that this file is present
|
|
# and status_of_proc is working.
|
|
. /lib/lsb/init-functions
|
|
|
|
case "$1" in
|
|
start)
|
|
[ "$VERBOSE" != no ] && log_action_begin_msg "Copying kdump files"
|
|
/usr/bin/ceph-kdump-copy
|
|
if [ "$?" -eq 0 ]; then
|
|
[ "$VERBOSE" != no ] && log_end_msg 0
|
|
else
|
|
[ "$VERBOSE" != no ] && log_end_msg 1
|
|
fi
|
|
;;
|
|
stop) # No-op
|
|
;;
|
|
status|reload|force-reload|restart)
|
|
echo "Error: argument '$1' not supported" >&2
|
|
echo "Usage: $SCRIPTNAME {start|stop}" >&2
|
|
exit 3
|
|
;;
|
|
*)
|
|
echo "Usage: $SCRIPTNAME {start|stop}" >&2
|
|
exit 3
|
|
;;
|
|
esac
|