path problem

Hi

i am writing a script containing processing commands which are reside in /opt/terascan/bin dir. if i run the script from command prompt it is working fine. but in crontab it is not working.

if i give env command from command prompt it is showing /opt/terascan/bin dir in PATH variable.

and the same env command if i put it script and run a crontab it is not working.

i shuld add /opt/terascan/bin dir path in my script.

how it is possible.

please help

thanks in advance

Just to be sure, set the PATH in your script. For any sh-style script, just add the line:

PATH=/opt/terascan/bin:$PATH; export PATH

For csh scripts, use:

set path=(/opt/terascan/bin $PATH)

Its just one line...

yes blowtorch,

thanks for your code.

it is partially working

please see my sh script

#! /bin/sh -f
#PATH=/opt/terascan/bin; export PATH
PATH=/opt/terascan/bin:$PATH; export PATH
ls -l > list
lspass > pas
peekauto > schedule \
num_days = '1' \

above script i run with crontab

but the error coming like this

satsetup: SATDATA undefined
satsetup: SATDATA undefined

please help

dear blowtorch,

i have run the script from command line using
sh test.sh command
but the error
PRM error. Parameter with no name found on command line.
is coming

please rectify this

From that error, it looks like the script needs more than just the PATH to be set. An environment variable called SATDATA might also be required to be set to an appropriate value. You are using lspass and peekauto which seem to be terascan commands. Can you check if any of them further call satsetup or directly use a variable SATDATA?

dear blowtorch,

thanks for your reply.

SATDATA env variable path is /opt/terascan/pass/satel dir
my i define this path to SATDATA in my script.

then please give me the syntax of this how to define SATDATA.

waiting for reply.

Since you are using sh for the script, you need to do this:

SATDATA=/opt/terascan/pass/satel; export SATDATA

Do this before you run those commands.

dear blowtorch,

i modified my script with adding SATDATA path to my script.
after that my script is like this.

# !/bin/sh -f
PATH=/opt/terascan/bin:$PATH; export PATH
SATDATA=/opt/terascan/pass/satel; export SATDATA
lspass > pas
peekauto > schedule \
num_days = '1' \
exit 0

now i run crontab . another problem is coming. in log.

PASSDIR not defined is coming.

my PASSDIR path is /opt/terascan/pass .

what should i do.

Dear blowtorch

i have added passdir path in my script.
please check the syntax .

# !/bin/sh -f
PATH=/opt/terascan/bin:$PATH; export PATH
PASSDIR=/opt/terascan/pass; export PASSDIR
SATDATA=/opt/terascan/pass/satel; export SATDATA
#PASSDIR=/opt/terascan/pass; export PASSDIR
lspass > pas
peekauto > schedule \
num_days = '1' \
exit 0

i have run the above script in crontab but the error

satsetup: PASSDIR not defined
satsetup: PASSDIR not defined

is coming.

please check and let me know.

Huh. The syntax looks to be OK. The variables are getting the values that you are setting them to. You might be having some documentation/man pages for this particular software that you are using. Why not go through that?

unable to solve the problem