User avatar
RichKavanagh
Posts: 31
Joined: Fri Aug 31, 2012 8:57 pm
Location: UK
Contact: Website

How best to call/run multiple Perl scripts sequentially?

Tue Feb 03, 2015 11:02 am

Hi everyone.

Looking for some help or advice please.

I have a series of Perl scripts which I need to run in a specific order, one after the other, every 10 minutes (forever).

For the sake of ease, let's say they're called:
  • script1.pl
  • script2.pl
  • script3.pl
  • script4.pl
  • script5.pl


I tried creating a single Perl script which had a simple 'do' command for each, and I added this to crontab but I ran in to problems with various declaration issues and I started getting a bit out of my depth at that point :lol: (I think this was to do with the scripts being nearly identical in their functions - they each run perfectly on their own)

Ideally, I'd have just one crontab job, running every 10mins, and that one cron job would then do something to call or run each of the perl scripts in order.

Am I missing something really obvious?

Any suggestions on how best to do this?

Thanks!

User avatar
RaTTuS
Posts: 10459
Joined: Tue Nov 29, 2011 11:12 am
Location: North West UK

Re: How best to call/run multiple Perl scripts sequentially?

Tue Feb 03, 2015 11:06 am

in cron - have full paths to everything
make it a bash script
which looks similar to :-

#!/bin/sh
/usr/local/bin/python /full/path/to/script1 command line args
/usr/local/bin/python /full/path/to/script2 command line args
/usr/local/bin/python /full/path/to/script3 command line args
/usr/local/bin/python /full/path/to/script4 command line args
How To ask Questions :- http://www.catb.org/esr/faqs/smart-questions.html
WARNING - some parts of this post may be erroneous YMMV

1QC43qbL5FySu2Pi51vGqKqxy3UiJgukSX
Covfefe

User avatar
RichKavanagh
Posts: 31
Joined: Fri Aug 31, 2012 8:57 pm
Location: UK
Contact: Website

Re: How best to call/run multiple Perl scripts sequentially?

Tue Feb 03, 2015 12:08 pm

Hi there!

Thanks for the response.

I had to change "/usr/local/bin/python" to "/usr/bin/perl"

And it appears to be working perfectly!

Cheers :D

User avatar
RaTTuS
Posts: 10459
Joined: Tue Nov 29, 2011 11:12 am
Location: North West UK

Re: How best to call/run multiple Perl scripts sequentially?

Tue Feb 03, 2015 12:10 pm

yeah - perl != python - but you figured it out ';-p
How To ask Questions :- http://www.catb.org/esr/faqs/smart-questions.html
WARNING - some parts of this post may be erroneous YMMV

1QC43qbL5FySu2Pi51vGqKqxy3UiJgukSX
Covfefe

Return to “Other programming languages”