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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
|
#!/bin/bash
#
# apport Script to control apport handling of core dumps
#
# Author: Will Woods <wwoods@redhat.com>
#
# chkconfig: - 90 10
# description: Starts and stops apport crash handling
# Source function library.
. /etc/init.d/functions
# The location of the core pattern file
PATFILE=/proc/sys/kernel/core_pattern
# The location of the apport binary
APPORT=/usr/share/apport/apport
# Location to save the old core_pattern
OLDPAT=/var/tmp/core_pattern
# Return success if apport is already enabled
apport_is_enabled() {
# XXX check the lock here too?
grep -q "^|.*apport" $PATFILE
}
enable_apport() {
if ! apport_is_enabled; then
cat $PATFILE > $OLDPAT
echo "|$APPORT" > $PATFILE
fi
}
disable_apport() {
if apport_is_enabled; then
cat $OLDPAT > $PATFILE
rm -f $OLDPAT
fi
}
start() {
action $"Enabling apport crash handling: " enable_apport
touch /var/lock/subsys/apport
}
stop() {
action $"Disabling apport crash handling: " disable_apport
rm -f /var/lock/subsys/apport
}
# See how we were called.
case "$1" in
start)
start
;;
stop)
stop
;;
status)
# FIXME are these the right return values?
if grep -q 'apport' $PATFILE; then
echo $"Apport is enabled."
exit 0
else
echo $"Apport is disabled."
exit 1
fi
;;
condrestart)
if [ -f /var/lock/subsys/apport ]; then
stop
start
fi
;;
restart|reload)
stop
start
;;
*)
echo $"Usage: $0 {start|stop|status|condrestart|restart|reload}"
exit 1
esac
exit 0
|