Automating Perl Script


I want to automate a  Perl script to run daily. Right now I am executing it from the command line as

uniserver:/usr/qa/Scripts/files> ./  filename

where is the script and the filename is the file it has to process.(like input file)

but when automating how can I call the script with the filename.

I tried it wrap it up in another script as:


do '/usr/qa/Scripts/files> ./  filename'      

and call the above script in Cron  but it is not working.

Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

why cant u hard code the variable inside the script..

instead of $1 ..use this my $filename=filename
new_perl_userAuthor Commented:

nemws1Database AdministratorCommented:
If you have a script in 'cron' that depends on a file in a local directory, you can do one of 2 things, either 'cd' to the directory first in your crontab and then "&&" the script you want to run (this is also what you want to do if your script opens a file for output and you want it in the same directory):
#min hour day.of.month month day.of.week command
30 3 * * * cd /usr/qa/Scripts/files && ./ filename

Open in new window

Or just give the full path to both the script and the filename:
#min hour day.of.month month day.of.week command
30 3 * * * /usr/qa/Scripts/files/ /usr/qa/Scripts/files/filename

Open in new window


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
new_perl_userAuthor Commented:

I tried earlier the second one but it did not work. will try the first option and will update.
Did the cron job fire? Did the script start?

If the cron job fired and script started but failed, or script proved unstartable root would get a mail about the problem.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.