SOURCES: apport.init (NEW) - initial release

patrys patrys at pld-linux.org
Thu Feb 14 01:53:51 CET 2008


Author: patrys                       Date: Thu Feb 14 00:53:51 2008 GMT
Module: SOURCES                       Tag: HEAD
---- Log message:
- initial release

---- Files affected:
SOURCES:
   apport.init (NONE -> 1.1)  (NEW)

---- Diffs:

================================================================
Index: SOURCES/apport.init
diff -u /dev/null SOURCES/apport.init:1.1
--- /dev/null	Thu Feb 14 01:53:51 2008
+++ SOURCES/apport.init	Thu Feb 14 01:53:46 2008
@@ -0,0 +1,84 @@
+#!/bin/bash
+#
+# apport    Script to control apport handling of core dumps
+#
+# Author:   Will Woods <wwoods at 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 %p %s %c'
+# Location to save the old core_pattern
+OLDPAT=/var/run/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() {
+	show "Enabling apport crash handling"
+	busy
+	enable_apport
+	touch /var/lock/subsys/apport
+	ok
+}
+
+stop() {
+	show "Disabling apport crash handling"
+	busy
+	disable_apport
+	rm -f /var/lock/subsys/apport
+	ok
+}
+
+# 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
+	;;
+  restart|reload)
+	stop
+	start
+	;;
+  *)
+	echo $"Usage: $0 {start|stop|status|restart|reload}"
+	exit 1
+esac
+
+exit 0
+
================================================================


More information about the pld-cvs-commit mailing list