]> git.pld-linux.org Git - packages/apport.git/commitdiff
- initial release
authorPatryk Zawadzki <patrys@room-303.com>
Thu, 14 Feb 2008 00:53:46 +0000 (00:53 +0000)
committercvs2git <feedback@pld-linux.org>
Sun, 24 Jun 2012 12:13:13 +0000 (12:13 +0000)
Changed files:
    apport.init -> 1.1

apport.init [new file with mode: 0644]

diff --git a/apport.init b/apport.init
new file mode 100644 (file)
index 0000000..a6b5d0b
--- /dev/null
@@ -0,0 +1,84 @@
+#!/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 %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
+
This page took 0.082231 seconds and 4 git commands to generate.