Operating System - HP-UX
1834202 Members
3067 Online
110066 Solutions
New Discussion

Re: binary not executed from crontab

 
Pat Peter
Occasional Advisor

binary not executed from crontab

Hi,

I have a binary which when tried to execute from the crontab does not get executed. But the same binary gets executed when done manually.

Can anyone please let me know what could be the problem.

Thanks,
Pat
11 REPLIES 11
Rick Garland
Honored Contributor

Re: binary not executed from crontab

Is the crontab entry for the binary fully PATHed?

The crontab has a minimal environment. There is no PATH. You must supply the full PATH to the command you wish to have executed in the crontab.
A. Clay Stephenson
Acclaimed Contributor

Re: binary not executed from crontab

In almost every case that is a problem with the environment. Cron's environment is intentionally very sparse. You may need to create a wrapper script that sets and exports and needed environment variables, including PATH, before executing your binary. The other problem you may have is that your executable expects stdin (or stdout) to be a tty (terminal) device which is not the case under cron.
If it ain't broke, I can fix that.
Mel Burslan
Honored Contributor

Re: binary not executed from crontab

what error messages are you getting when this job fails ?
________________________________
UNIX because I majored in cryptology...
Victor BERRIDGE
Honored Contributor

Re: binary not executed from crontab

Hi,
You may not have the PATH set for it...

Add the PATH variable to your binary in a shell script and call your binary from it also
then use the shell script in your crontab file
or use the fullpath to your binary in the cronfile

All the best
Victor
Pat Peter
Occasional Advisor

Re: binary not executed from crontab

The PATH is set correct. The same crontab entry use to work sometimes back but the server crashed once and after that only one particular executable is not getting executed properly. All the other executables are working fine.

Thanks,
Pat
TwoProc
Honored Contributor

Re: binary not executed from crontab

I've seen that. Loosen up the directory permissions all along the path until you see it working. Fix the problem and tighten the permissions back down all along the way to your executable.
We are the people our parents warned us about --Jimmy Buffett
Geoff Wild
Honored Contributor

Re: binary not executed from crontab

You say the PATH is correct?

Try this in cron:

echo $PATH; /your/binary >/tmp/yourbinary.cronlog 2>&1

Check the log for errors...

Rgds..Geoff
Proverbs 3:5,6 Trust in the Lord with all your heart and lean not on your own understanding; in all your ways acknowledge him, and he will make all your paths straight.
Pat Peter
Occasional Advisor

Re: binary not executed from crontab

Can anyone please tell me where do I look for the cronlogs in HP UX-10.20

Thanks,
Pat
Rick Garland
Honored Contributor

Re: binary not executed from crontab

/var/adm/cron/log

Geoff Wild
Honored Contributor

Re: binary not executed from crontab

Sorry - the log I meant was if you run it the way I suggest - any errors will be in /tmp/yourbinary.cronlog

Rgds...Geoff
Proverbs 3:5,6 Trust in the Lord with all your heart and lean not on your own understanding; in all your ways acknowledge him, and he will make all your paths straight.
Carles Viaplana
Valued Contributor

Re: binary not executed from crontab

I had same problem some time ago and it was due our executable loads stdin/stdout libraries without use them.

Check source code if you load stdin/stdout libraries. Set as comment and try.

Regards,

Carles