1
votes

When I try to run a Perl script which is called via Linux script manually it works fine but not executable via CRON.

Linux_scrip.sh conatains Perl_script and the command is,

perl_path/perl Perl_script.pl

I got perl_path using which perl command.

Can anyone suggest why is it not executable via CRON entry.

2
what is the error ? what is in crontab ?michael501
The first thing to do whenever a cronjob "isn't working" is to check the cron logs. On my system, the log is in /var/log/cron, but it could be different for you. That will tell you if the job is actually being run, and if so, any errors it might be generating.ThisSuitIsBlackNot

2 Answers

3
votes

Most likely suspects:

  • Current work directory isn't as expected.
  • Permission issues[1].
  • Environment variables aren't setup as expected.
  • Requirement of a terminal can't be met.

See the crontab tag wiki for more pitfalls and some debugging tips.

The first thing you should do is to read the error message.


  1. This isn't likely to be an issue for you own cron job, but I've included it since it's quite a common problem for scripts run from other services.
0
votes

Most probable cause is current working directory.

Before perl command execution, write a command to change directory.

Something like :

cd  perl_path;

perl Perl_script.pl