1777316 Members
3002 Online
109068 Solutions
New Discussion юеВ

Cron and script failing

 
SOLVED
Go to solution
Carl Munnelly
Frequent Advisor

Cron and script failing

I think I know the solution but just want it confirming.

Got a user (informix) running cron, but crons are failing.

However logged in as user manually and it asked me which version (i.e wanted inputting an enviroment variable)

I'm assuming this is why crons are failing as not completing this login process.
7 REPLIES 7
Peter Godron
Honored Contributor
Solution

Re: Cron and script failing

Carl,
cron does not use the login environment scripts like .profile etc.
So if you want to have the same environment, you have to execute the .profile from within your cron job.
Jeff_Traigle
Honored Contributor

Re: Cron and script failing

That would be true. cron jobs are run non-interactively and none of the initialization files (/etc/profile and ${HOME}/.profile) are sourced. Any variables that are needed by the script, must be defined in the script or explicitly sourced from an existing file. PATH is also very minimal in the cron environment.
--
Jeff Traigle
Carl Munnelly
Frequent Advisor

Re: Cron and script failing

Thanks guys, just been pointed out that used to be trusted system. No entry in cronaids for informix
Carl Munnelly
Frequent Advisor

Re: Cron and script failing

put entry in crontab to touch dummy files. This failed with rc=1. but if command run as informix user maunally file created successfully.
James R. Ferguson
Acclaimed Contributor

Re: Cron and script failing

Hi Carl:

To use 'cron' if the account name appears in the '/usr/lib/cron/cron.allow'. If that file doesn't exist, then a crontask is allowd if the account name doesn't appear in the '/usr/lib/cron/cron.deny'. Do you have an "allow" entry?

Regards!

...JRF...
Carl Munnelly
Frequent Advisor

Re: Cron and script failing

noticed sticky bit for cron not set right

was r_Sr_xr_x changed to r_sr_xr_x and working fine.

Thanks for help
Carl Munnelly
Frequent Advisor

Re: Cron and script failing

see my last comments, this was resolution.