diff options
author | Stig Thormodsrud <stig@io.vyatta.com> | 2009-02-16 18:02:17 -0800 |
---|---|---|
committer | Stig Thormodsrud <stig@io.vyatta.com> | 2009-02-16 18:02:17 -0800 |
commit | c45f7b9f8daae3b96c76fac3363a507c22b9d9f3 (patch) | |
tree | b8e46d0fe080426aaa9beca23cd843a0212ee73f /scripts/vyatta-protocol | |
parent | 0f4a6d1a24f937aafc6ba2014c94dc42cf9251eb (diff) | |
parent | 5205f4cd0d68a78c86fce6588f9c276861bb9cdd (diff) | |
download | vyatta-cfg-quagga-c45f7b9f8daae3b96c76fac3363a507c22b9d9f3.tar.gz vyatta-cfg-quagga-c45f7b9f8daae3b96c76fac3363a507c22b9d9f3.zip |
Merge branch 'jenner' of http://git.vyatta.com/vyatta-cfg-quagga into jenner
Diffstat (limited to 'scripts/vyatta-protocol')
-rwxr-xr-x | scripts/vyatta-protocol | 26 |
1 files changed, 16 insertions, 10 deletions
diff --git a/scripts/vyatta-protocol b/scripts/vyatta-protocol index ba68e9e9..65ee3d76 100755 --- a/scripts/vyatta-protocol +++ b/scripts/vyatta-protocol @@ -5,13 +5,14 @@ progname=$0 usage() { echo "Usage: $progname {start|stop|restart} {bgpd|ospfd|ripd|ripngd}" - exit 1; + exit 1 } if [ $# -lt 2 ]; then usage fi + daemon=$2 exe_file=/usr/sbin/vyatta-$daemon @@ -21,15 +22,20 @@ log_dir=/var/log/vyatta/quagga if [ ! -x $exe_file ]; then echo "Unknown daemon $daemon" - exit 1; + exit 1 +fi + +if [ $EUID -ne 0 ]; then + echo "must be root!" + exit 1 fi case "$1" in start) - sudo start-stop-daemon --start --quiet \ + start-stop-daemon --start --quiet \ --chdir $log_dir --exec $exe_file \ -- -d -P 0 -i $pid_dir/${daemon}.pid - sudo start-stop-daemon --start --quiet \ + start-stop-daemon --start --quiet \ --chdir $log_dir \ --exec /usr/sbin/vyatta-watchquagga \ -- -p $pid_dir/watch-${daemon}.pid \ @@ -37,18 +43,18 @@ case "$1" in ;; stop) - sudo start-stop-daemon --stop --quiet --oknodo --retry 2 \ + start-stop-daemon --stop --quiet --oknodo --retry 2 \ --pidfile $pid_dir/watch-${daemon}.pid - sudo rm -f $pid_dir/watch-${daemon}.pid - sudo start-stop-daemon --stop --quiet --oknodo --retry 2 \ + rm -f $pid_dir/watch-${daemon}.pid + start-stop-daemon --stop --quiet --oknodo --retry 2 \ --exec $exe_file - sudo rm -f $pid_dir/${daemon}.pid + rm -f $pid_dir/${daemon}.pid ;; restart) # Restart daemon - sudo start-stop-daemon --stop --quiet --oknodo --exec $exe_file - sudo start-stop-daemon --start --quiet \ + start-stop-daemon --stop --quiet --oknodo --exec $exe_file + start-stop-daemon --start --quiet \ --chdir $log_dir --exec $exe_file \ -- -d -P 0 -i $pid_dir/${daemon}.pid |