aditya
aditya

Reputation: 149

Crontab job does not work properly

I have to schedule a crontab job for my Perl script. To have proper environment variables I execute it via Bash script. It is executing properly, but not able to execute a GFS command which is:

my $string = `gluster file info`;    

My cron job is: (calling it through a Bash script)

* * * * * /root/MyWeb-App/bin/crontab.pl PATH=/MyWeb-App/bin

My Bash script is:

#!/bin/bash    
/root/MyWeb-App/bin/crontab.pl

After executing the script, $string is empty. So what's wrong with this?

Upvotes: 0

Views: 93

Answers (1)

ikegami
ikegami

Reputation: 385506

Right now, you are passing PATH=/MyWeb-App/bin as an argument to crontab.pl. I doubt that crontab.pl even check for arguments.

Perhaps you were trying to set the PATH environment variable. If so, the syntax is:

PATH=/MyWeb-App/bin /root/MyWeb-App/bin/crontab.pl 

You might want to add to $PATH rather than replacing it, though.

PATH="/MyWeb-App/bin:$PATH" /root/MyWeb-App/bin/crontab.pl 

Upvotes: 2

Related Questions