LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 07-23-2007, 04:41 PM   #1
Elguapo
Member
 
Registered: Mar 2005
Distribution: FC7
Posts: 42

Rep: Reputation: 15
Creating AT jobs with perl


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

Last edited by Elguapo; 07-23-2007 at 04:47 PM.
 
Old 07-23-2007, 06:20 PM   #2
stress_junkie
Senior Member
 
Registered: Dec 2005
Location: Massachusetts, USA
Distribution: Ubuntu 10.04 and CentOS 5.5
Posts: 3,873

Rep: Reputation: 335Reputation: 335Reputation: 335Reputation: 335
I think that the bash control script is the way to go.
 
Old 07-23-2007, 06:39 PM   #3
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.2
Posts: 18,362

Rep: Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751
Why switch langs ie Perl -> cold fusion?
Parsing eg CSV files & inserting into a DB is a natural for Perl.
It's a more integrated solution and (presumably) you can skip the AT job as well.
 
Old 07-23-2007, 06:43 PM   #4
Elguapo
Member
 
Registered: Mar 2005
Distribution: FC7
Posts: 42

Original Poster
Rep: Reputation: 15
After the initial ftp download. I have to manipulate several files outside of the csv files that I download. The other main reason is once the files have been parsed and inserted into the database I have several over coupled cold fusion functions that must also fire off.

But anyways, I finally got it figured out and have it running just the way I like.

Last edited by Elguapo; 07-23-2007 at 06:45 PM.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Creating Cron Jobs simba_cubs Linux - General 1 09-27-2006 05:42 PM
Executing Perl under Dos /Creating an executable for DOS alix123 Programming 1 02-15-2006 04:07 AM
Perl/CGI Creating Auto Logouts (like bank sites) anthonysaulnier Programming 3 10-17-2005 12:36 PM
creating userid's in perl BBQ_Matt Programming 1 01-28-2004 01:23 PM
creating cron jobs jonfa Linux - General 5 05-26-2002 05:05 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 08:48 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration