0
votes

I have a cron job that runs several shell scripts:

30 1 * * 1-5 /ufs/00/home/usr/bin/ConsentforFoo.sh "prd"
15 1 * * 1-5 /ufs/00/home/usr/bin/apptTvoxforFoo.sh

the first shell script looks like this:

 #!/bin/bash
 # ConsentforFoo.sh - set different environments, set path to perl scripts, calls      script

TMP_HOME=/home/localweb/htdocs/cgi-bin/usr/CFoodir

if [ "$1" = "dev" ] || [ "$1" = "uat" ] || [ "$1" = "prd" ]
then
cd $TMP_HOME/$1
My-Consent-Cron.pl
else
echo "Val Not Set: $1"
fi

this script works flawlessly... However, the second shell script looks like this:

 #!/bin/bash
 # apptTvoxforFoo.sh - sends MHT population and patients with multiple appointments to west

 TMP_HOME=/home/localweb/htdocs/cgi-bin/usr/CFoodir
cd $TMP_HOME
TvoxCron.pl #adding './' works here

but when it runs, I get an error saying: "sh: /ufs/00/home/usr/bin/apptTvoxforFoo.sh: cannot execute"

I add a "pwd" to the shell script and it's getting in the right directory and the file is there...

Weirdest thing is when I add "./" to it, it works... but in the first shell script I don't have to...

Any ideas why taking the if/then/else out would force me to SOURCE the perl script?

Thanks for any help you can provide.

1
What does ls -l /ufs/00/home/usr/bin/ConsentforFoo.sh /ufs/00/home/usr/bin/apptTvoxforFoo.sh return? Do both perl script have a correct shebang? #!/usr/bin/perl - Emilien
./script.pl is not "sourcing" the script, it's just calling it from a relative path. - choroba
I think this was prob the issue... this sh script was set for "-rw-r--r--" vs "-rwxr-xr-x" for the one that is working... I have a feeling this will fix the problem. Rookie mistake. Thanks! - user1801932

1 Answers

1
votes

Did you check the file permissions on the directories and all the files? Can you add a dot in front of the file to make sure you are not finding the file on the path?

./TvoxCron.pl