summaryrefslogtreecommitdiff
path: root/debian/ceph-kdump-copy.init
blob: 617d95890219a0e52106a8d56a21134a4d5816bd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
#! /bin/sh
### BEGIN INIT INFO
# Provides:          ceph-kdump-copy
# Required-Start:    $remote_fs $network $named
# Required-Stop:     $remote_fs $network $named
# 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