Add new Debian package "corekeeper" to centralize and reap core files.
authorBen Pfaff <blp@nicira.com>
Wed, 5 Nov 2008 23:46:25 +0000 (15:46 -0800)
committerBen Pfaff <blp@nicira.com>
Wed, 5 Nov 2008 23:48:59 +0000 (15:48 -0800)
debian/.gitignore
debian/control.in
debian/corekeeper.cron.daily [new file with mode: 0755]
debian/corekeeper.init [new file with mode: 0755]
debian/rules

index bfe60c9319134900820bdbe56f41b660cb6547d1..21ba0d13d1a67d43d0cf670073ad6a452249db8a 100644 (file)
@@ -3,6 +3,7 @@
 *.substvars
 /automake.mk
 /control
+/corekeeper
 /files
 /openflow
 /openflow-common
index bcda15bbb1b8d5b8b43c5b27fdca0f5a769a65a4..371dd4a52016746771bdcb019307a83a3de51f86 100644 (file)
@@ -76,3 +76,10 @@ Description: OpenFlow controller implementation
  .
  OpenFlow is a protocol for flow-based control over network switching.
 
+Package: corekeeper
+Architecture: all
+Depends: tmpreaper
+Description: Core file centralizer and reaper
+ The corekeeper package configures the system to dump all core files to
+ /var/log/core.  It also deletes core files older than 7 days.
+
diff --git a/debian/corekeeper.cron.daily b/debian/corekeeper.cron.daily
new file mode 100755 (executable)
index 0000000..badc192
--- /dev/null
@@ -0,0 +1,5 @@
+#! /bin/sh
+
+PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
+
+tmpreaper 7d --mtime --all /var/log/core
diff --git a/debian/corekeeper.init b/debian/corekeeper.init
new file mode 100755 (executable)
index 0000000..27d62a1
--- /dev/null
@@ -0,0 +1,63 @@
+#!/bin/sh 
+#
+# Example init.d script with LSB support.
+#
+# Please read this init.d carefully and modify the sections to
+# adjust it to the program you want to run.
+#
+# Copyright (c) 2007 Javier Fernandez-Sanguino <jfs@debian.org>
+#
+# This is free software; you may redistribute it and/or modify
+# it under the terms of the GNU General Public License as
+# published by the Free Software Foundation; either version 2,
+# or (at your option) any later version.
+#
+# This is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License with
+# the Debian operating system, in /usr/share/common-licenses/GPL;  if
+# not, write to the Free Software Foundation, Inc., 59 Temple Place,
+# Suite 330, Boston, MA 02111-1307 USA
+#
+### BEGIN INIT INFO
+# Provides:          corekeeper
+# Required-Start:
+# Required-Stop:     
+# Should-Start:      $syslog
+# Should-Stop:       
+# Default-Start:     2 3 4 5
+# Default-Stop:      0 1 6
+# Short-Description: Configure core file dump location
+### END INIT INFO
+
+PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
+
+. /lib/lsb/init-functions
+
+set -e
+
+case "$1" in
+  start)
+       log_daemon_msg "Initializing core dump location..."
+        if echo "/var/log/core/core.%e.%t" > /proc/sys/kernel/core_pattern
+        then
+            log_progress_msg "success"
+            log_end_msg 0
+            exit 0
+        else 
+            log_end_msg 1
+            exit 1
+        fi
+       ;;
+  stop|restart|force-reload|status|reload)
+        exit 0
+        ;;
+  *)
+       N=/etc/init.d/$NAME
+       echo "Usage: $N {start|stop|restart|force-reload|status}" >&2
+       exit 1
+       ;;
+esac
index 5b25308e76b9a0d4ad9cc008fdc1878cfc628d16..cefcd3245b83a43304eb30392804ca3d439ff0b5 100755 (executable)
@@ -111,6 +111,7 @@ install-indep: build-indep
        dh_install -i
        cd debian/openflow-datapath-source/usr/src && tar -c modules | bzip2 -9 > openflow-datapath.tar.bz2 && rm -rf modules
        install -m644 debian/openflow-pki-server.apache2 debian/openflow-pki-server/etc/apache2/sites-available/openflow-pki
+       install -m1777 -d debian/corekeeper/var/log/core
        $(ext_install_indep)
 
 install-arch: build-arch
@@ -135,11 +136,12 @@ binary-common:
        dh_installdebconf
        dh_installlogrotate
        dh_installinit
+       dh_installcron
        dh_installman
        dh_link
        dh_strip
        dh_compress 
-       dh_fixperms
+       dh_fixperms -X var/log/core
        dh_perl
        dh_makeshlibs
        dh_installdeb