X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=debian%2Fopenvswitch-controller.init;h=b073ddef07c8265ca0ff45864c98b86aac3374f9;hb=a644168568471eb33f8d1e60e872859f4e5bbc69;hp=ee9c44d5de2c75ab6a2901c09ba2a3cfd2e9ddd8;hpb=064af42167bf4fc9aaea2702d80ce08074b889c0;p=openvswitch diff --git a/debian/openvswitch-controller.init b/debian/openvswitch-controller.init index ee9c44d5..b073ddef 100755 --- a/debian/openvswitch-controller.init +++ b/debian/openvswitch-controller.init @@ -1,5 +1,6 @@ #!/bin/sh # +# Copyright (c) 2011 Nicira, Inc. # Copyright (c) 2007, 2009 Javier Fernandez-Sanguino # # This is free software; you may redistribute it and/or modify @@ -19,30 +20,32 @@ # ### BEGIN INIT INFO # Provides: openvswitch-controller -# Required-Start: $network $local_fs -# Required-Stop: +# Required-Start: $network $local_fs $remote_fs +# Required-Stop: $remote_fs # Should-Start: $named # Should-Stop: # Default-Start: 2 3 4 5 # Default-Stop: 0 1 6 # Short-Description: Open vSwitch controller +# Description: The Open vSwitch controller enables OpenFlow switches that connect to it +# to act as MAC-learning Ethernet switches. ### END INIT INFO PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin -DAEMON=/usr/sbin/controller # Introduce the server's location here +DAEMON=/usr/bin/ovs-controller # Introduce the server's location here NAME=ovs-controller # Introduce the short server's name here DESC=ovs-controller # Introduce a short description here LOGDIR=/var/log/openvswitch # Log directory to use -PIDFILE=/var/run/$NAME.pid +PIDFILE=/var/run/openvswitch/$NAME.pid test -x $DAEMON || exit 0 . /lib/lsb/init-functions # Default options, these can be overriden by the information -# at /etc/default/$NAME +# at /etc/default/openvswitch-controller DAEMON_OPTS="" # Additional options given to the server DODTIME=10 # Time to wait for the server to die, in seconds @@ -57,7 +60,7 @@ LOGFILE=$LOGDIR/$NAME.log # Server logfile # Include defaults if available default=/etc/default/openvswitch-controller if [ -f $default ] ; then - . $default + . $default fi # Check that the user exists (if we set a user) @@ -105,6 +108,10 @@ start_server() { exit 0 fi + if [ ! -d /var/run/openvswitch ]; then + install -d -m 755 -o root -g root /var/run/openvswitch + fi + SSL_OPTS= case $LISTEN in *ssl*) @@ -142,7 +149,7 @@ start_server() { $SSL_OPTS errcode=$? fi - return $errcode + return $errcode } stop_server() { @@ -158,7 +165,7 @@ stop_server() { errcode=$? fi - return $errcode + return $errcode } reload_server() { @@ -171,27 +178,27 @@ reload_server() { force_stop() { # Force the process to die killing it manually - [ ! -e "$PIDFILE" ] && return - if running ; then - kill -15 $pid - # Is it really dead? - sleep "$DIETIME"s - if running ; then - kill -9 $pid - sleep "$DIETIME"s - if running ; then - echo "Cannot kill $NAME (pid=$pid)!" - exit 1 - fi - fi - fi - rm -f $PIDFILE + [ ! -e "$PIDFILE" ] && return + if running ; then + kill -15 $pid + # Is it really dead? + sleep "$DODTIME" + if running ; then + kill -9 $pid + sleep "$DODTIME" + if running ; then + echo "Cannot kill $NAME (pid=$pid)!" + exit 1 + fi + fi + fi + rm -f $PIDFILE } case "$1" in start) - log_daemon_msg "Starting $DESC " "$NAME" + log_daemon_msg "Starting $DESC " "$NAME" # Check if it's running first if running ; then log_progress_msg "apparently already running" @@ -209,7 +216,7 @@ case "$1" in # a false positive (use 'status' for that) log_end_msg 1 fi - ;; + ;; stop) log_daemon_msg "Stopping $DESC" "$NAME" if running ; then @@ -232,16 +239,16 @@ case "$1" in force_stop log_end_msg $? fi - ;; + ;; restart|force-reload) log_daemon_msg "Restarting $DESC" "$NAME" stop_server # Wait some sensible amount, some server need this - [ -n "$DIETIME" ] && sleep $DIETIME + [ -n "$DODTIME" ] && sleep $DODTIME start_server running log_end_msg $? - ;; + ;; status) log_daemon_msg "Checking status of $DESC" "$NAME" @@ -260,10 +267,10 @@ case "$1" in log_warning_msg "cannot re-read the config file (use restart)." ;; *) - N=/etc/init.d/$NAME - echo "Usage: $N {start|stop|force-stop|restart|force-reload|status}" >&2 - exit 1 - ;; + N=/etc/init.d/openvswitch-controller + echo "Usage: $N {start|stop|force-stop|restart|force-reload|status}" >&2 + exit 1 + ;; esac exit 0