I have created a perl script that downloads csv files on a daily basis, I then use a cold fusion script to parse and insert these csv files into our database.
The issue I have is that no matter what I do, I can not get perl to create an AT job. I end up having to create a separate shell script just to create the AT job, but I would like to get away from this and start using perl to create these jobs for me.
Here is my perl script I am using.
my $urlHost = $ARGV[2];
my $script = "/usr/local/bin/cfcCron.sh";
my $command = "${cfcCron} ${urlHost} core.idx.com.IDXManager idxParse | at now +15 minutes";
if (system("$command &> /dev/null") == 0){
print " success, exit status = $?\n";
} else {
print " failure, exit status = $?\n";
}
Here is the cfcCron.sh shell script.
#!/bin/sh
cfInstance=$1
callto=`echo $2 | sed -e 's/\./\//g'`
cfMethod=$3
url=$cfInstance$callto".cfc?method="$cfMethod
echo $url
curl $url
When I use the code above to create the AT job this is the command it says it is going to run. It is not the right command.
http://192.168.10.112/core/idx/com/I...ethod=idxParse
But when I add it via the schell script below. I get this command which is correct.
/usr/local/bin/cfcCron.sh
http://192.168.10.112/ core.idx.com.IDXManager 'idxParse'
#!/bin/sh
#Command line variables
script=$1
instanceURL=$2
echo "$script $instanceURL core.idx.com.IDXManager 'idxParse'" | at now +15 minutes