#!/bin/tcsh

# Get the current hostname without the domain
set current_host=`hostname -s`

# convert the hostname string to uppercase
set hostUpper=`echo $current_host | tr '[a-z]' '[A-Z]'`
echo "Host upper is " $hostUpper


#get the scaler IOC name by replacing IOC and ROC by SCLR 
set ioc_name=`echo $hostUpper | sed "s/IOC/SCLR/; s/ROC/SCLR/"`

# Build the booting file for the current host by replacing the IOC name for 
# iocAdminSoft using sed. 

sed -e s/XXXHOSTNAMEXXX/$ioc_name/  scalers.cmd >! ./$current_host.cmd
chmod +x ./$current_host.cmd

#excute the IOC booting script
exec     ./$current_host.cmd
