Sravan Palaki
Sravan Palaki

Reputation: 63

Perl script in linux environment is not working via cron

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.

Upvotes: 1

Views: 103

Answers (2)

Ravi  K M
Ravi K M

Reputation: 87

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

Upvotes: 0

ikegami
ikegami

Reputation: 385506

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.

Upvotes: 3

Related Questions