Re-usable system command

Hi,
I have a system command that performs a ftp download and is used a bunch of different graphs. It looks something like:

day=`date2str(dateadd(today(),${DAY_OFFSET},day),“yyyyMMdd”)`;
if [ -f ${DATAIN_DIR}/${FILE_NAME}_“$day”_Full.zip ]
then
echo “skipping download data-in/${FILE_NAME}_$day_Full.zip exists”;
else
wget -O ${DATAIN_DIR}/${FILE_NAME}_“$day”_Full.zip ${FTP_URL}/${FILE_NAME}_???_Full.zip;
fi

I have all these parameters so I can adapt the script to different graphs just by setting the parameters in the graph or a parameter file. Now I would like to be able to re-use the script itself so that if I change it, I don’t have to edit every graph that uses it. I looked at putting its own file, but I need the variables to get bound and date CTL to run.

Any recommendations about how I might be able to reuse the script? Most components allow some sort of URL for data like this to be read.

Thanks.

Hello,
just create file with external parameter (e.g. batch.prm):

batch=day\=20100429;\nif [ -f ./data-in/input_"$day"_Full.zip ]\nthen\necho "skipping download data-in/input_$day_Full.zip exists";\nelse\nwget -O ./data-in/input_"$day"_Full.zip koule/input_????????_Full.zip;\nfi

attach it to your graph:

<Property fileURL="batch.prm" id="GraphParameter0"/>

and use in SystemExecute node: