Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Re: running perl file

by Corion (Patriarch)
on Nov 01, 2020 at 13:09 UTC ( [id://11123329]=note: print w/replies, xml ) Need Help??


in reply to running perl file

What have you tried? How did it fail?

Basically, if you want a cron job, use a cron job.

The common problem with cron jobs is to assume that the cron job has the same environment and current working directory as an interactive session. This is not the case.

You will need to set up your cron job to run with a defined working directory and a defined environment. The easiest approach to doing that is to call your main program through a shell script like:

#!/bin/bash set -ae # load the environment source ~/.bash_profile source ~/.profile # Set the working directory to the directory the shell script # and Perl script live in: cd $(dirname $0) # Find the name of the Perl script: THIS_SCRIPT=$(basename $0) PERL_SCRIPT=${THIS_SCRIPT/.sh/pl} echo "Running $PERL_SCRIPT" # Launch it: exec $PERL_SCRIPT

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11123329]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others rifling through the Monastery: (4)
As of 2024-04-16 16:38 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found