| 1 | #!/bin/shscip-shell filesystem . . `/bin/sh`. |
| 2 | # |
| 3 | # /etc/rc.d/init.d/atm - Bring up/down ATM |
| 4 | # |
| 5 | # chkconfig: 2345 09 91 |
| 6 | # description: Loads/Unloads ATM drivers and starts/stops basic services |
| 7 | # |
| 8 | ### BEGIN INIT INFO |
| 9 | # Provides: atm |
| 10 | # Required-Start: $local_fs dbus haldaemon |
| 11 | # Should-Start: |
| 12 | # Required-Stop: |
| 13 | # Should-Stop: |
| 14 | # Default-Start: 2 3 5 |
| 15 | # Default-Stop: |
| 16 | # Description: Loads/Unloads ATM drivers and starts/stops basic services |
| 17 | ### END INIT INFO |
| 18 | |
| 19 | # Source function library. |
| 20 | |
| 21 | # source function library |
| 22 | if [scip-shell system . . `[`. -f /etc/init.d/functionsscip-shell filesystem . . `/etc/init.d/functions`. ]; then |
| 23 | . /etc/init.d/functionsscip-shell source . . `/etc/init.d/functions`. |
| 24 | alias start_daemon=daemon |
| 25 | elif [scip-shell system . . `[`. -f /etc/rc.d/init.d/functionsscip-shell filesystem . . `/etc/rc.d/init.d/functions`. ]; then |
| 26 | . /etc/rc.d/init.d/functionsscip-shell source . . `/etc/rc.d/init.d/functions`. |
| 27 | alias start_daemon=daemon |
| 28 | elif [scip-shell system . . `[`. -f /lib/lsb/init-functionsscip-shell filesystem . . `/lib/lsb/init-functions`. ]; then |
| 29 | . /lib/lsb/init-functionsscip-shell source . . `/lib/lsb/init-functions`. |
| 30 | elif [scip-shell system . . `[`. -f /sbin/startprocscip-shell filesystem . . `/sbin/startproc`. ]; then |
| 31 | alias start_daemon=/sbin/startprocscip-shell filesystem . . `/sbin/startproc`. |
| 32 | else |
| 33 | exit 0 |
| 34 | fi |
| 35 | |
| 36 | if [scip-shell system . . `[`. -f /etc/rc.statusscip-shell filesystem . . `/etc/rc.status`. ]; then |
| 37 | . /etc/rc.statusscip-shell source . . `/etc/rc.status`. |
| 38 | else |
| 39 | rc_resetscip-shell shell shell-project 0.0.0 rc_reset().() { RETVAL=0; } |
| 40 | rc_failedscip-shell shell shell-project 0.0.0 rc_failed().() |
| 41 | { |
| 42 | if [scip-shell system . . `[`. -z "$1" ]; then |
| 43 | RETVAL=1; |
| 44 | elif [scip-shell system . . `[`. "$1" -ne 0 ]; then |
| 45 | RETVAL=$1; |
| 46 | fi |
| 47 | } |
| 48 | rc_checkscip-shell shell shell-project 0.0.0 rc_check().() { rc_failedscip-shell shell shell-project 0.0.0 rc_failed(). $?; } |
| 49 | rc_exitscip-shell shell shell-project 0.0.0 rc_exit().() { exit $RETVAL; } |
| 50 | rc_statusscip-shell shell shell-project 0.0.0 rc_status().() |
| 51 | { |
| 52 | if [scip-shell system . . `[`. "$?" = "-v" ]; then |
| 53 | [scip-shell system . . `[`. $RETVAL -eq 0 ] && success || failure |
| 54 | fi |
| 55 | } |
| 56 | |
| 57 | fi |
| 58 | rc_resetscip-shell shell shell-project 0.0.0 rc_reset(). |
| 59 | |
| 60 | if [scip-shell system . . `[`. ! -f /etc/sysconfig/atmscip-shell filesystem . . `/etc/sysconfig/atm`. ]; then |
| 61 | rc_failedscip-shell shell shell-project 0.0.0 rc_failed(). 6 |
| 62 | rc_exitscip-shell shell shell-project 0.0.0 rc_exit(). |
| 63 | fi |
| 64 | |
| 65 | . /etc/sysconfig/atmscip-shell source . . `/etc/sysconfig/atm`. |
| 66 | |
| 67 | [scip-shell system . . `[`. "$ATM" != yes ] && exit 0 |
| 68 | |
| 69 | if [scip-shell system . . `[`. -d /etc/sysconfig/network-scriptsscip-shell filesystem . . `/etc/sysconfig/network-scripts`. ]; then |
| 70 | cd /etc/sysconfig/network-scriptsscip-shell filesystem . . `/etc/sysconfig/network-scripts`. |
| 71 | elif [scip-shell system . . `[`. -d /etc/sysconfig/networkscip-shell filesystem . . `/etc/sysconfig/network`. ]; then |
| 72 | cd /etc/sysconfig/networkscip-shell filesystem . . `/etc/sysconfig/network`. |
| 73 | else |
| 74 | rc_failedscip-shell shell shell-project 0.0.0 rc_failed(). |
| 75 | rc_statusscip-shell shell shell-project 0.0.0 rc_status(). -v |
| 76 | rc_exitscip-shell shell shell-project 0.0.0 rc_exit(). |
| 77 | fi |
| 78 | |
| 79 | clipinterfaces=$(lsscip-shell system . . ls. ifcfg-atm[0-9] 2> /dev/nullscip-shell filesystem . . `/dev/null`. | sedscip-shell system . . sed. -e 's/^ifcfg-//g') |
| 80 | laneinterfaces=$(lsscip-shell system . . ls. ifcfg-lec[0-9] 2> /dev/nullscip-shell filesystem . . `/dev/null`. | sedscip-shell system . . sed. -e 's/^ifcfg-//g') |
| 81 | nasinterfaces=$(lsscip-shell system . . ls. ifcfg-nas[0-9] 2> /dev/nullscip-shell filesystem . . `/dev/null`. | sedscip-shell system . . sed. -e 's/^ifcfg-//g') |
| 82 | |
| 83 | case "$1" in |
| 84 | start) |
| 85 | echoscip-shell system . . echo. -n "Starting ATM demons" |
| 86 | |
| 87 | [scip-shell system . . `[`. -z "$ATMMODULES" ] || /sbin/modprobescip-shell filesystem . . `/sbin/modprobe`. "$ATMMODULES" |
| 88 | |
| 89 | start_daemon /usr/sbin/atmsigdscip-shell filesystem . . `/usr/sbin/atmsigd`. -b -u uni31 -l syslog -D /var/tmpscip-shell filesystem . . `/var/tmp`. -t 20 -c /etc/atmsigd.confscip-shell filesystem . . `/etc/atmsigd.conf`. |
| 90 | rc_checkscip-shell shell shell-project 0.0.0 rc_check(). |
| 91 | start_daemon /usr/sbin/ilmidscip-shell filesystem . . `/usr/sbin/ilmid`. -b -u 3.1 -l syslog ${ILMIQOS:+ -q $ILMIQOS} |
| 92 | rc_checkscip-shell shell shell-project 0.0.0 rc_check(). |
| 93 | if [scip-shell system . . `[`. "$IPATM" = yes ]; then |
| 94 | start_daemon /usr/sbin/atmarpdscip-shell filesystem . . `/usr/sbin/atmarpd`. -b -l syslog -m |
| 95 | rc_checkscip-shell shell shell-project 0.0.0 rc_check(). |
| 96 | for i in $clipinterfaces; do |
| 97 | /usr/sbin/atmarpscip-shell filesystem . . `/usr/sbin/atmarp`. -c $i |
| 98 | rc_checkscip-shell shell shell-project 0.0.0 rc_check(). |
| 99 | done |
| 100 | fi |
| 101 | if [scip-shell system . . `[`. "$BR2684" = yes ]; then |
| 102 | for i in $nasinterfaces; do |
| 103 | (. ifcfg-$i |
| 104 | |
| 105 | ITF=`echoscip-shell system . . echo. $i | sedscip-shell system . . sed. -e 's/nas//'` |
| 106 | start_daemon /usr/sbin/br2684ctlscip-shell filesystem . . `/usr/sbin/br2684ctl`. -b \ |
| 107 | -c $ITF \ |
| 108 | ${PAYLOAD:+ -p $PAYLOAD } \ |
| 109 | ${ENCAPSULATION:+ -e $ENCAPSULATION} \ |
| 110 | ${QOS:+ -q $QOS} \ |
| 111 | ${VPIVCI:+ -a $VPIVCI} |
| 112 | rc_checkscip-shell shell shell-project 0.0.0 rc_check(). |
| 113 | ) |
| 114 | done |
| 115 | fi |
| 116 | if [scip-shell system . . `[`. "$LANE" = yes ]; then |
| 117 | for i in $laneinterfaces; do |
| 118 | (. ifcfg-$i |
| 119 | |
| 120 | ITF=`echoscip-shell system . . echo. $i | sedscip-shell system . . sed. -e 's/lec//'` |
| 121 | start_daemon /usr/sbin/zeppelinscip-shell filesystem . . `/usr/sbin/zeppelin`. -b \ |
| 122 | -i $ITF -l $ITF \ |
| 123 | ${VLAN:+ -n $VLAN} \ |
| 124 | ${LECS:+ -c $LECS} \ |
| 125 | ${VERSION:+ -$VERSION} \ |
| 126 | ${MTU:+ -t $MTU} \ |
| 127 | ${ESI:+ -e $ESI} \ |
| 128 | ${V2CAPABLE:+ -2} \ |
| 129 | ${DEBUG:+ -m $DEBUG} \ |
| 130 | -F /var/log/${DEVICE} |
| 131 | rc_checkscip-shell shell shell-project 0.0.0 rc_check(). |
| 132 | ) |
| 133 | done |
| 134 | fi |
| 135 | touchscip-shell system . . touch. /var/lock/subsys/atmscip-shell filesystem . . `/var/lock/subsys/atm`. |
| 136 | rc_statusscip-shell shell shell-project 0.0.0 rc_status(). -v |
| 137 | ;; |
| 138 | |
| 139 | stop) |
| 140 | echoscip-shell system . . echo. -n "Stopping ATM demons" |
| 141 | if [scip-shell system . . `[`. "$LANE" = yes ]; then |
| 142 | for i in $laneinterfaces; do |
| 143 | ./ifdown $i |
| 144 | [scip-shell system . . `[`. -f "/var/run/${i}.pid" ] && killscip-shell system . . kill. -TERM `catscip-shell system . . cat. /var/run/${i}.pid` |
| 145 | done |
| 146 | fi |
| 147 | if [scip-shell system . . `[`. "$BR2684" = yes ]; then |
| 148 | for i in $nasinterfaces; do |
| 149 | ./ifdown $i |
| 150 | [scip-shell system . . `[`. -f "/var/run/br2684ctl-${i}.pid" ] && killscip-shell system . . kill. -TERM `catscip-shell system . . cat. /var/run/br2684ctl-${i}.pid` |
| 151 | done |
| 152 | fi |
| 153 | if [scip-shell system . . `[`. "$IPATM" = yes ]; then |
| 154 | for i in $clipinterfaces; do |
| 155 | ./ifdown $i |
| 156 | done |
| 157 | killproc atmarpd |
| 158 | fi |
| 159 | killproc atmsigd # kill ILMID later, so we don't get complaints |
| 160 | killproc ilmid |
| 161 | |
| 162 | [scip-shell system . . `[`. -z "$ATMMODULES" ] || /sbin/modprobescip-shell filesystem . . `/sbin/modprobe`. -r "$ATMMODULES" |
| 163 | |
| 164 | rmscip-shell system . . rm. -f /var/lock/subsys/atmscip-shell filesystem . . `/var/lock/subsys/atm`. |
| 165 | rc_statusscip-shell shell shell-project 0.0.0 rc_status(). -v |
| 166 | ;; |
| 167 | |
| 168 | restart) |
| 169 | $0 stop |
| 170 | $0 start |
| 171 | ;; |
| 172 | |
| 173 | *) |
| 174 | echoscip-shell system . . echo. "Usage: atm {start|stop|restart}" |
| 175 | exit 1 |
| 176 | esac |
| 177 | rc_exitscip-shell shell shell-project 0.0.0 rc_exit(). |