#!/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_all ROCs_group" echo " --------------------------------" echo " List of possible ROCs_groups:" echo " FCALN6 - will reboot: rocfcal1, rocfcal2, .. , rocfcal6" echo " FCALN2 - will reboot: rocfcal1, rocfcal2" echo " FCALS6 - will reboot: rocfcal7, rocfcal8, .. , rocfcal12" echo " FCALALL - will reboot: rocfcal1, rocfcal2, .. , rocfcal12" echo " BCALN6 - will reboot: rocbcal1, rocbcal2, .. , rocbcal6" echo " BCALS6 - will reboot: rocbcal7, rocbcal8, .. , rocbcal12" echo " BCALALL - will reboot: rocbcal1, rocbcal2, .. , rocbcal12" echo "" exit(0) endif #*** Set list of ROCs *** # set input_group = $argv[1] set input_group = `echo $1 | tr '[a-z]' '[A-Z]' ` set rocs_group = ( FCALN6 FCALN2 FCALS6 FCALALL BCALN6 BCALS6 BCALALL ) set FCALN6 = ( rocfcal1 rocfcal2 rocfcal3 rocfcal4 rocfcal5 rocfcal6 ) set FCALN2 = ( rocfcal1 rocfcal2 ) set FCALS6 = ( rocfcal7 rocfcal8 rocfcal9 rocfcal10 rocfcal11 rocfcal12 ) set FCALALL = ( rocfcal1 rocfcal2 rocfcal3 rocfcal4 rocfcal5 rocfcal6 \ rocfcal7 rocfcal8 rocfcal9 rocfcal10 rocfcal11 rocfcal12 ) set BCALN6 = ( rocbcal1 rocbcal2 rocbcal3 rocbcal4 rocbcal5 rocbcal6 ) set BCALS6 = ( rocbcal7 rocbcal8 rocbcal9 rocbcal10 rocbcal11 rocbcal12 ) set BCALALL = ( rocbcal1 rocbcal2 rocbcal3 rocbcal4 rocbcal5 rocbcal6 \ rocbcal7 rocbcal8 rocbcal9 rocbcal10 rocbcal11 rocbcal12 ) #*** Check ROCs names *** set ii = -1 set kk = 0 foreach word ($rocs_group) @ kk++ if ( $word == $input_group ) set ii = $kk end # echo "ii = $ii"; echo "rocs_group = $rocs_group[$ii]" if ($ii == 1 ) then set RR = "$FCALN6" else if ($ii == 2 ) then set RR = "$FCALN2" else if ($ii == 3 ) then set RR = "$FCALS6" else if ($ii == 4 ) then set RR = "$FCALALL" else if ($ii == 5 ) then set RR = "$BCALN6" else if ($ii == 6 ) then set RR = "$BCALS6" else if ($ii == 7 ) then set RR = "$BCALALL" else echo "" echo " Unknown ROCs_group. Please check the ROCs_group name." echo " Use -h for help." echo "" exit (-1) endif #*** Reboot ROCs *** foreach roc ($RR) echo " ... roc_reboot $roc" roc_reboot $roc end exit (0)