diff options
author | Stephen Hemminger <stephen.hemminger@vyatta.com> | 2009-07-09 16:06:26 -0700 |
---|---|---|
committer | Stephen Hemminger <stephen.hemminger@vyatta.com> | 2009-10-13 16:39:08 -0700 |
commit | 53dc1cc6aff4c5a85ce5f5f89007a503a6e363ed (patch) | |
tree | 9010bc1334ad2a58e03b5c071535134d6f0c8ac7 /scripts | |
parent | 548a22cca3daa57fd592647bc93ae2370c705f94 (diff) | |
download | vyatta-cfg-quagga-53dc1cc6aff4c5a85ce5f5f89007a503a6e363ed.tar.gz vyatta-cfg-quagga-53dc1cc6aff4c5a85ce5f5f89007a503a6e363ed.zip |
Remove dynamic start of routing daemons
The CLI begin transaction restrictions make this impossible to
do in a stable manner.
Related to bug 4537
(cherry picked from commit dcebd6d713e76b3e01ba51710693d688e1570cdb)
Diffstat (limited to 'scripts')
-rwxr-xr-x | scripts/quagga-manager | 132 |
1 files changed, 0 insertions, 132 deletions
diff --git a/scripts/quagga-manager b/scripts/quagga-manager deleted file mode 100755 index 5beb8780..00000000 --- a/scripts/quagga-manager +++ /dev/null @@ -1,132 +0,0 @@ -#! /bin/bash -# -# This is special script for start,stop,restart of quagga daemons -# - -# debug -# echo $* | logger -p local7.debug -t quagga-manager - -usage() { - echo "Usage: $0 {check|start|stop|restart} {bgpd|ospfd|ripd|ospf6d|ripngd} ..." - exit 1 -} - -if [ $# -lt 1 ]; then - usage -fi - -pid_dir=/var/run/vyatta/quagga -log_dir=/var/log/vyatta/quagga - -. /lib/lsb/init-functions - -status() { - local daemon=$1 - 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 pidfile=${pid_dir}/${daemon}.pid - local binpath=/usr/sbin/vyatta-$daemon - - if [ $EUID -ne 0 ]; then - echo "must be root!" - exit 1 - fi - - if [ ! -x $binpath ]; then - echo "Unknown daemon $daemon" - return 1 - fi - - local -a args=( -d -P 0 -i $pidfile ) - case $daemon in - zebra) args+=( -l -S -s 1048576 );; - bgpd) args+=( -I );; - esac - - start-stop-daemon --start --oknodo --quiet \ - --chdir $log_dir --exec $binpath --pidfile $pidfile -- ${args[@]} -} - -stop() { - local daemon=$1 - local pidfile=${pid_dir}/${daemon}.pid - local binpath=/usr/sbin/vyatta-$daemon - - if [ $EUID -ne 0 ]; then - echo "must be root!" - exit 1 - fi - start-stop-daemon --stop --quiet --oknodo --retry 5 \ - --exec $binpath --pidfile=$pidfile - rm -f $pidfile -} - -get_protocol() { - local daemon=$1 - case $daemon in - bgpd|ospfd|ripd|ripngd|isisd) echo ${daemon/%d/};; - ospf6d) echo "ospfv3";; - *) echo "Unknown daemon $daemon" 1>&2; exit 1;; - esac -} - -reload_config() { - local daemon=$1 - local proto=$(get_protocol $daemon) - - local vyatta_cfg=/opt/vyatta/config/active - local path=$vyatta_cfg/protocols/$proto - - # If daemon does not have config nothing to do. - [ -d $path ] || return; - - # Begin reloading transaction - /opt/vyatta/sbin/vyatta-cfg-cmd-wrapper begin || exit 1 - - # In case of error undo - trap "/opt/vyatta/sbin/vyatta-cfg-cmd-wrapper end" EXIT HUP INT QUIT TERM - - # Save current configuration - tmp=/tmp/${daemon}-restart.$$ - /opt/vyatta/sbin/vyatta-save-config.pl $tmp || exit 1 - - # Erase portion of active configuration for that protocol - rm -fr $path - - # special case for interface, remove parameters force reload - case $proto in - rip|ospf) - find $vyatta_cfg/interfaces -type d -path "*/ip/$proto" \ - -exec rm -fr '{}' \; ;; - ripng|ospfv3) - find $vyatta_cfg/interfaces -type d -path "*/ipv6/$proto" \ - -exec rm -fr '{}' \; ;; - esac - - # Reload causing configuration to activate - implies commit - /opt/vyatta/sbin/vyatta-load-config.pl $tmp || exit 1 - - # remove tmp file if successful - rm $tmp - trap "" EXIT HUP INT QUIT TERM -} - -action=$1 -shift - -for daemon; do - case "$action" in - start) start $daemon ;; - stop) stop $daemon ;; - status) status $daemon ;; - reload) start $daemon; reload_config $daemon ;; - restart) stop $daemon; start $daemon ;; - *) usage;; - esac -done - |