-2

i created a Cron Job on my GoDaddy Server, named "SponUpdate.sh"

here is the code for this file

#!/bin/bash

/usr/bin/perl /home/content/14/5959214/html/cgi/JLLoadSponFRJ.pl
/usr/bin/perl /home/content/14/5959214/html/cgi/JLLoadSponMGJ.pl
/usr/bin/perl /home/content/14/5959214/html/cgi/JLLoadSponCAD.pl
/usr/bin/perl /home/content/14/5959214/html/cgi/JLLoadSponCJB.pl

Now the issue is when this cron Job Runs it says me following Error,

"/bin/sh: /var/chroot/home/content/14/5959214/html/cgi/SponUpdate.sh: /bin/bash: bad interpreter: Permission denied"

here is the code for one of Perl File "JLLoadSponFRJ.pl"

my $command = '/web/cgi-bin/php5 -q $HOME/html/GISJobs/JLLoadSpon.php';
exec ($command) or print STDERR "couldn't exec $command: $!";

i am unable to resolve it from last 3 days,

Please help me,

Thanks in advance,

Regards,

Shabi
  • 13
  • 4

2 Answers2

2

So you're launching a cron job that runs a bash script that calls some perl scripts that call php. Why don't you just call php directly from cron?

Check that your bash script does not contain "\r\n" line endings: You might be trying to invoke "/bin/bash\r" instead of "/bin/bash"

glenn jackman
  • 238,783
  • 38
  • 220
  • 352
  • here is my code please check if there is ny \r or \n `#!/bin/bash /usr/bin/perl /home/content/14/5959214/html/cgi/JLLoadSponFRJ.pl /usr/bin/perl /home/content/14/5959214/html/cgi/JLLoadSponMGJ.pl /usr/bin/perl /home/content/14/5959214/html/cgi/JLLoadSponCAD.pl /usr/bin/perl /home/content/14/5959214/html/cgi/JLLoadSponCJB.pl` – Shabi Oct 12 '12 at 14:56
  • actually the reason to not adding PHP script in .sh file is code is on more then 2000 lines and database connection etc – Shabi Oct 12 '12 at 15:04
0

You can check the bash path with

which bash
and then you can correct the shebang !#/bin/bash of the perl script.
Micromega
  • 12,486
  • 7
  • 35
  • 72
  • thanks for your answer, would you please let me know how i can use this script ? `which bash` and how i see the response ? becasue i am a PHP developer – Shabi Oct 12 '12 at 14:54
  • which is a unix program; you need a terminal account to use this program. – Micromega Oct 12 '12 at 15:16
  • how can i check the unix programe? as i already told you that i am not much familier with UNIX etc – Shabi Oct 12 '12 at 15:25
  • @shabi: when you type php -v in terminal gives it version number and cli mode support? – Micromega Oct 12 '12 at 15:35