debian: Init script should put core dumps in an appropriate place
authorEthan Jackson <ethan@nicira.com>
Wed, 15 Sep 2010 08:51:15 +0000 (01:51 -0700)
committerEthan Jackson <ethan@nicira.com>
Wed, 15 Sep 2010 11:51:40 +0000 (04:51 -0700)
Before this commit the init script did not change the cwd of
openvswitch processes it started.  Thus, core files were created in
root directory.  This patch changes the cwd of openvswitch to
a more reasonable location.

AUTHORS
debian/openvswitch-switch.init

diff --git a/AUTHORS b/AUTHORS
index a5d042fb331acbaeb218a874d7347ab218609a3f..75a6de5c97c9ab0b3f9ca10049ec6286dc1d5019 100644 (file)
--- a/AUTHORS
+++ b/AUTHORS
@@ -6,6 +6,7 @@ Ben Pfaff               blp@nicira.com
 Bryan Phillippe         bp@toroki.com
 Dan Wendlandt           dan@nicira.com
 David Erickson          derickso@stanford.edu
+Ethan Jackson           ethan@nicira.com
 Glen Gibb               grg@stanford.edu
 Ian Campbell            Ian.Campbell@citrix.com
 Jean Tourrilhes         jt@hpl.hp.com
index a933a21ae70a3a68a807779d0b62dc3a35992c71..d860630378d10fc1c2758553996f9efac58e445f 100755 (executable)
@@ -230,12 +230,16 @@ case "$1" in
             install -d -m 755 -o root -g root /var/log/openvswitch
         fi
 
+        if [ ! -d /var/log/openvswitch/cores ]; then
+            install -d -m 755 -o root -g root /var/log/openvswitch/cores
+        fi
+
         # Start ovsdb-server.
         set --
         set -- "$@" /etc/openvswitch/conf.db
         set -- "$@" --verbose=ANY:console:emer --verbose=ANY:syslog:err
         set -- "$@" --log-file=/var/log/openvswitch/ovsdb-server.log
-        set -- "$@" --detach --pidfile $monitor_opt
+        set -- "$@" --detach --no-chdir --pidfile $monitor_opt
         set -- "$@" --remote punix:/var/run/openvswitch/db.sock
         set -- "$@" --remote db:Open_vSwitch,managers
         set -- "$@" --private-key=db:SSL,private_key
@@ -245,6 +249,7 @@ case "$1" in
         echo -n "Starting ovsdb-server: "
         start-stop-daemon --start --quiet \
             --pidfile /var/run/openvswitch/ovsdb-server.pid \
+            --chdir /var/log/openvswitch/cores              \
             --exec $ovsdb_server -- "$@"
         if running ovsdb-server; then
             echo "ovsdb-server."
@@ -258,12 +263,13 @@ case "$1" in
         set --
         set -- "$@" --verbose=ANY:console:emer --verbose=ANY:syslog:err
         set -- "$@" --log-file=/var/log/openvswitch/ovs-vswitchd.log
-        set -- "$@" --detach --pidfile $monitor_opt
+        set -- "$@" --detach --no-chdir --pidfile $monitor_opt
         set -- "$@" unix:/var/run/openvswitch/db.sock
         set -- "$@" $OVS_VSWITCHD_OPTS
         echo -n "Starting ovs-vswitchd: "
         start-stop-daemon --start --quiet \
             --pidfile /var/run/openvswitch/ovs-vswitchd.pid \
+            --chdir /var/log/openvswitch/cores              \
             --exec $ovs_vswitchd -- "$@"
         if running ovs-vswitchd; then
             echo "ovs-vswitchd."
@@ -275,12 +281,14 @@ case "$1" in
         echo -n "Stopping ovs-vswitchd: "
         start-stop-daemon --stop --quiet --oknodo --retry 5 \
             --pidfile /var/run/openvswitch/ovs-vswitchd.pid \
+            --chdir /var/log/openvswitch/cores              \
             --exec $ovs_vswitchd
         echo "ovs-vswitchd."
 
         echo -n "Stopping ovsdb-server: "
         start-stop-daemon --stop --quiet --oknodo --retry 5 \
             --pidfile /var/run/openvswitch/ovsdb-server.pid \
+            --chdir /var/log/openvswitch/cores              \
             --exec $ovsdb_server
         echo "ovsdb-server."
         ;;