#!/bin/csh -f #*** Print help message if -h or -help specified *** set flag = 0 if ($#argv == 0 ) then set flag = 1 endif if ($flag == 0 ) then if (($argv[1] == "-h") || ($argv[1] == "-help") || \ ($argv[1] == "help") || ($argv[1] == "--help")) then set flag = 2 endif endif # echo "N_argv = $#argv"; echo "flag = $flag" if ($flag != 0 ) then echo "" echo " Usage: roc_reboot roc_name" echo " ---------------------------" echo " List of possible ROC names:" echo " roctrg10 roctrg11 roctrg12 (this three in F117)" echo " rocfcal1 - rocfcal12 rocbcal1 - rocbcal16" echo " iocpulser1" echo "" exit(0) endif #*** Transliterate input argv to lower-case characters *** set roc = `echo $1 | tr '[A-Z]' '[a-z]' ` #*** Set list of ROCs *** set roc_name = ( roctrg10 roctrg11 roctrg12 \ rocfcal1 rocfcal2 rocfcal3 rocfcal4 \ rocfcal5 rocfcal6 rocfcal7 rocfcal8 \ rocfcal9 rocfcal10 rocfcal11 rocfcal12 \ rocbcal1 rocbcal2 rocbcal3 rocbcal4 \ rocbcal5 rocbcal6 rocbcal7 rocbcal8 \ rocbcal9 rocbcal10 rocbcal11 rocbcal12 \ rocbcal13 rocbcal14 rocbcal15 rocbcal16 \ iocpulser1 ) #*** Set IP list for ROCs snmp-controlled *** set ip_snmp = ( 129.57.36.112 129.57.36.132 129.57.36.111 \ 129.57.26.28 129.57.26.29 129.57.26.30 129.57.26.31 \ 129.57.26.32 129.57.26.33 129.57.26.34 129.57.26.35 \ 129.57.26.36 129.57.26.37 129.57.26.38 129.57.26.39 \ 129.57.26.49 129.57.26.50 129.57.26.51 129.57.26.52 \ 129.57.26.53 129.57.26.54 129.57.26.55 129.57.26.56 \ 129.57.26.57 129.57.26.58 129.57.26.59 129.57.26.60 \ 129.57.26.125 129.57.26.126 129.57.26.122 129.57.26.121 \ 129.57.26.120 ) #*** Check ROC name *** set ii = -1 set ii_snmp = 0 foreach word ($roc_name) @ ii_snmp++ if ( $roc == $word ) set ii = $ii_snmp end if ( $ii == -1 ) then echo "" echo " Unknown ROC. Please check the ROC name." echo " Use -h for help." echo "" exit (-1) endif #*** Reboot ROC *** set ip = ${ip_snmp[$ii]} # echo " ip=$ip; " snmpset -v 1 -c private $ip enterprises.19947.1.1.1.0 i 0 sleep 5 snmpset -v 1 -c private $ip enterprises.19947.1.1.1.0 i 1 exit (0)