#!/bin/tcsh


# $1 0=all rocs  
# $2 VERSION NUMBER


if ($#argv < 2) then
    echo "Insufficent parameters:"
    echo " ./startall.csh ROC VERSION"
    echo "                ROC = 0 start all ROCS"
    exit
endif

if ($1 == 0) then
    echo "Start up all FDC ROCS with version "$2" to set DAC values for baseline"
    echo "ROC 2"
    ssh hdfdcops@rocfdc2 /home/hdfdcops/scripts/startupbaseline.csh 2 $2 14  \&
    echo "ROC 3"
    ssh hdfdcops@rocfdc3 /home/hdfdcops/scripts/startupbaseline.csh 3 $2 14  \&
    echo "ROC 5"
    ssh hdfdcops@rocfdc5 /home/hdfdcops/scripts/startupbaseline.csh 5 $2 14  \&
    echo "ROC 6"
    ssh hdfdcops@rocfdc6 /home/hdfdcops/scripts/startupbaseline.csh 6 $2 15  \&
    echo "ROC 7"
    ssh hdfdcops@rocfdc7 /home/hdfdcops/scripts/startupbaseline.csh 7 $2 15  \& 
    echo "ROC 8"
    ssh hdfdcops@rocfdc8 /home/hdfdcops/scripts/startupbaseline.csh 8 $2 14  \& 
    echo "ROC 9"
    ssh hdfdcops@rocfdc9 /home/hdfdcops/scripts/startupbaseline.csh 9 $2 15  \& 
    echo "ROC 10"
    ssh hdfdcops@rocfdc10 /home/hdfdcops/scripts/startupbaseline.csh 10 $2 15  \&  
    echo "ROC 11"
    ssh hdfdcops@rocfdc11 /home/hdfdcops/scripts/startupbaseline.csh 11 $2 14  \&  
    echo "ROC 12"
    ssh hdfdcops@rocfdc12 /home/hdfdcops/scripts/startupbaseline.csh 12 $2 14  \&  
else
    if ( ($1 < 6) || ($1 == 8) || ($1 > 10) ) then
        echo "Start up all FDC ROC "$1" with version "$2        
        ssh -f hdfdcops@rocfdc$1 /home/hdfdcops/scripts/startupbaseline.csh $1 $2 14 \&
    else
        echo "Start up all FDC ROC "$1" with version "$2      
        ssh -f hdfdcops@rocfdc$1 /home/hdfdcops/scripts/startupbaseline.csh $1 $2 15 \&
    endif

endif
