#!/bin/csh -f
#####################################################################
#                                                                   #
#  Title: sns_pcasRun                                               #
#                                                                   #
#  Purpose: Executable file to start SNS's Portable CA Server       #
#           This script is called from the Virtual Accelerator      #
#            or, of course, can be called from the command line     #
#                                                                   #
#  History: 17Jan2006 Debbie Rogind created                         #
#                                                                   #
######################################################################
#
source /afs/slac/g/lcls/xal/config/xalSetup.csh
# get the input file that VA has output 

#cd $LCDATA/xal
# FOR NOW - use ~ dir for this file - permission denied on nfs ($LCDATA) still
cd ~

# sns_cas [-d<debug level>]  [-t<execution time>]  [-f=<nameOfInpFile>]  [-fout=<nameOfOutPutFile>]  [-s<D>] 
# run forever, scan off, default debug level  
# (maybe some options should be inputs to the script?)

if ($1 == "start" ) then
#  sns_pcas  -f=$XAL/config/$2  -fout=$LCDATA/xal/pv_names.out
    echo "starting sns_cas" 
	#$EPICS/extensions/bin/linux-x86/sns_cas -d2 -s0  -f=$2  -fout=pv_name.out 
    sns_cas -d2 -s0  -f=$2  -fout=pv_name.out &	
endif	
if ($1 == "kill" ) then
    pkill -u $USER sns_cas
endif

# End of script

