1753925 Members
8918 Online
108810 Solutions
New Discussion юеВ

Re: script inquiry

 
Pando
Regular Advisor

script inquiry

I have created a script for file processing. During manual execution, it did process right. However, when i put it in cron it did not process it correctly. Any comment on this?
12 REPLIES 12
steven Burgess_2
Honored Contributor

Re: script inquiry

Hi Fernando

post the cron entry

Steve
take your time and think things through
Con O'Kelly
Honored Contributor

Re: script inquiry

Hi Fernando

Most likely you need to ensure you have set full paths for any commands in the script.
cron has a very limited PATH variable setting.

Cheers
Con



Rajeev Tyagi
Valued Contributor

Re: script inquiry

Furnando,

It may be a problem with PATH environment variable which is not sourced in the script during cron execution. Define your PATH environment variable in script.

Pando
Regular Advisor

Re: script inquiry

Hello Steven,

herewith is the cron entry:

0 16 * * * /test/parset/scripts/parset

Attached is the script i've made:



Pando
Regular Advisor

Re: script inquiry

Guys,

I also see in my directory a file #parset# along with the my script parset. what do you mean by this?
Muthukumar_5
Honored Contributor

Re: script inquiry

Plz. post your script.
cat /test/parset/scripts/parset

HTH.
Easy to suggest when don't know about the problem!
Gordon  Morrison_1
Regular Advisor

Re: script inquiry

There may be other environment variables set in your .profile besides $PATH that your script needs (without seeing the script it's hard to tell)
Try this for a cron entry:

0 16 * * * . /path/to/homedir/.profile;/test/parset/scripts/parset

Don't miss out the dot & space before the first command.
What does this button do?
Pando
Regular Advisor

Re: script inquiry

Guys,

Please see attached script.
Muthukumar_5
Honored Contributor

Re: script inquiry

what is ur entry for crontab.

Did you get any useful informations in cron log (/var/adm/cron/log )?

If you are able to execute in command line, then crontab informations will be the problem.

Edit your script second line as,
set -x
# To get debug symbols

Try to execute your script as,
crontab -e

* * * * * /tmp/log 2>&1

save and check log file. post that info.

hth.
Easy to suggest when don't know about the problem!