#!/bin/bash RETVAL=0 prog="rx3-net" #DEBUG="" #DEBUG="echo" #DEBUG=":" #LOG=":" #LOG="echo" # Includes #----------------------------------------------------------------------------------------------------------------------------------- . /usr/local/lib/network.bash #-------------------------------------------------------------------------------------------------------------------------- # Start #-------------------------------------------------------------------------------------------------------------------------- start() { echo "Starting..." if [ -r /var/lock/subsys/rx3-net ] then echo "already started" RETVAL=0 else network_start RETVAL=$? [ "$RETVAL" = 0 ] && touch /var/lock/subsys/rx3-net fi echo } #-------------------------------------------------------------------------------------------------------------------------- # Stop #-------------------------------------------------------------------------------------------------------------------------- stop() { echo "Stopping..." if [ -r /var/lock/subsys/rx3-net ] then network_stop RETVAL=$? else echo "already stopped" RETVAL=0 fi [ "$RETVAL" = 0 ] && rm -f /var/lock/subsys/rx3-net echo } #-------------------------------------------------------------------------------------------------------------------------- # Status #-------------------------------------------------------------------------------------------------------------------------- status() { network_status } #-------------------------------------------------------------------------------------------------------------------------- # Dump #-------------------------------------------------------------------------------------------------------------------------- dump() { network_tab_dump } #-------------------------------------------------------------------------------------------------------------------------- # Table_Set #-------------------------------------------------------------------------------------------------------------------------- table_set() { echo "Setting ip:$1 table:$2" network_table_set $1 $2 } #-------------------------------------------------------------------------------------------------------------------------- # Address_Refresh #-------------------------------------------------------------------------------------------------------------------------- address_refresh() { dst_id="$1" if [[ "${dst_id}" != "" ]] then echo "Refreshing address: [${dst_id}]..." network_dst_tab_get ${dst_id} network_dst_address_refresh ${dst_id} ${dst_host_name} ${dst_ip} else echo "Refreshing all address..." network_dst_address_refresh_all fi } #-------------------------------------------------------------------------------------------------------------------------- # Main #-------------------------------------------------------------------------------------------------------------------------- network_init case "$1" in start) start ;; stop) stop ;; restart) stop sleep 1 start ;; status) status ;; dump) dump ;; table_set) table_set $2 $3 ;; refresh_address) address_refresh $2 ;; *) echo "Usage: $0 {start|stop|restart|status|dump|table_set|refresh_address}" RETVAL=1 ;; esac network_deinit exit $RETVAL