summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStephen Hemminger <stephen.hemminger@vyatta.com>2009-05-07 09:07:43 -0700
committerStephen Hemminger <stephen.hemminger@vyatta.com>2009-05-07 09:07:43 -0700
commit580b08fdb0c476cce9713f06491997c5214b7663 (patch)
tree69b1f84e97405b54e7fcc3936d4f0ff23ae62eae
parentbbed2745a8cb5e24bae333333bbe9befa78a0f24 (diff)
downloadvyatta-cfg-quagga-580b08fdb0c476cce9713f06491997c5214b7663.tar.gz
vyatta-cfg-quagga-580b08fdb0c476cce9713f06491997c5214b7663.zip
Redefine quagga-manager check as start
No need for check if start checks if already running
-rw-r--r--interface-templates/ip/ospf/node.def2
-rw-r--r--interface-templates/ip/rip/node.def2
-rw-r--r--interface-templates/ipv6/ospfv3/node.def2
-rw-r--r--interface-templates/ipv6/ripng/node.def2
-rwxr-xr-xscripts/quagga-manager28
5 files changed, 22 insertions, 14 deletions
diff --git a/interface-templates/ip/ospf/node.def b/interface-templates/ip/ospf/node.def
index 31980774..6842b5bd 100644
--- a/interface-templates/ip/ospf/node.def
+++ b/interface-templates/ip/ospf/node.def
@@ -1,2 +1,2 @@
help: Set Open Shortest Path First (OSPF) parameters for specified interface
-create: sudo /opt/vyatta/sbin/quagga-manager check ospfd
+create: sudo /opt/vyatta/sbin/quagga-manager start ospfd
diff --git a/interface-templates/ip/rip/node.def b/interface-templates/ip/rip/node.def
index b01a779f..7818921b 100644
--- a/interface-templates/ip/rip/node.def
+++ b/interface-templates/ip/rip/node.def
@@ -1,2 +1,2 @@
help: Set Routing Information Protocol (RIP) for specified interface
-create: sudo /opt/vyatta/sbin/quagga-manager check ripd
+create: sudo /opt/vyatta/sbin/quagga-manager start ripd
diff --git a/interface-templates/ipv6/ospfv3/node.def b/interface-templates/ipv6/ospfv3/node.def
index 3e8380e6..1dbba902 100644
--- a/interface-templates/ipv6/ospfv3/node.def
+++ b/interface-templates/ipv6/ospfv3/node.def
@@ -1,2 +1,2 @@
help: Set IPv6 Open Shortest Path First (OSPFv3) parameters for specified interface
-create: sudo /opt/vyatta/sbin/quagga-manager check ospf6d
+create: sudo /opt/vyatta/sbin/quagga-manager start ospf6d
diff --git a/interface-templates/ipv6/ripng/node.def b/interface-templates/ipv6/ripng/node.def
index d59da359..977303db 100644
--- a/interface-templates/ipv6/ripng/node.def
+++ b/interface-templates/ipv6/ripng/node.def
@@ -1,2 +1,2 @@
help: Set Routing Information Protocol (RIPng) for specified interface
-create: sudo /opt/vyatta/sbin/quagga-manager check ripngd
+create: sudo /opt/vyatta/sbin/quagga-manager start ripngd
diff --git a/scripts/quagga-manager b/scripts/quagga-manager
index 58c91b66..77cb5f5a 100755
--- a/scripts/quagga-manager
+++ b/scripts/quagga-manager
@@ -23,19 +23,27 @@ fi
pid_dir=/var/run/vyatta/quagga
log_dir=/var/log/vyatta/quagga
-check() {
+. /lib/lsb/init-functions
+
+status() {
local daemon=$1
- [ -f ${pid_dir}/${daemon}.pid ] || start $daemon
+ local pidfile=${pid_dir}/${daemon}.pid
+ local binpath=/usr/sbin/vyatta-$daemon
+ status_of_proc -p $pidfile $binpath $daemon && exit 0 || exit $?
}
start() {
local daemon=$1
- local exe_file=/usr/sbin/vyatta-$daemon
+ local pidfile=${pid_dir}/${daemon}.pid
+ local binpath=/usr/sbin/vyatta-$daemon
- if [ ! -x $exe_file ]; then
+ if [ ! -x $binpath ]; then
echo "Unknown daemon $daemon"
- exit 1
+ return 1
fi
+
+ # already running?
+ pidofproc $pidfile $daemon >/dev/null && return 0
local -a args=( -d -P 0 -i ${pid_dir}/${daemon}.pid )
case $daemon in
@@ -60,17 +68,17 @@ start() {
;;
esac
- start-stop-daemon --start --quiet --oknodo \
- --chdir $log_dir --exec $exe_file \
+ start-stop-daemon --start --quiet \
+ --chdir $log_dir --exec $binpath \
-- "${args[@]}"
}
stop() {
local daemon=$1
- local exe_file=/usr/sbin/vyatta-$daemon
+ local binpath=/usr/sbin/vyatta-$daemon
start-stop-daemon --stop --quiet --oknodo --retry 5 \
- --exec $exe_file --pidfile=$pid_dir/${daemon}.pid
+ --exec $binpath --pidfile=$pid_dir/${daemon}.pid
rm -f $pid_dir/${daemon}.pid
}
@@ -165,9 +173,9 @@ update() {
case "$1" in
- check) check $2;;
start) start $2;;
stop) stop $2;;
+ status) status $2;;
update) update;;
reload) start $2; reload_config $2;;
restart) stop $2; start $2;;