Operating System - HP-UX
1835399 Members
2507 Online
110078 Solutions
New Discussion

Re: What the shell is going on?

 
SOLVED
Go to solution
jason thompson_1
Frequent Advisor

What the shell is going on?

After doing a fresh install of 11.11 on vg00 from 10.20, there are some cron jobs that will not run. However, a user can execute the job without problem. I have looked at the .profile and /etc/profile of the users before the update and cannot see any difference in the profiles. Where should I be looking on the old system for differences in the environment?
What's that smell?
8 REPLIES 8
Pete Randall
Outstanding Contributor

Re: What the shell is going on?

Jason,

Speaking of shells, what shell are they using? Are the shells listed in /etc/shells?

Have you checked the cron log at /var/adm/cronlog? Are the jobs even starting?


Pete

Pete
Rodney Hills
Honored Contributor

Re: What the shell is going on?

Did you hardcode any paths to commands or files that no longer exist on your new system?

-- Rod Hills
There be dragons...
A. Clay Stephenson
Acclaimed Contributor

Re: What the shell is going on?

What in the wide, wide, world of sports does .profile and/or /etc/profile have to do with cron? Answer: NOTHING. Cron's environment (including PATH) is extremely and intentionally sparse. You must explicitly set and export any needed environment variables within the cron'ed script itself. My preferred way to do this is to have a small script (e.g. /usr/local/bin/myenv.sh) that is SOURCED via . /usr/local/bin/myenv.sh by both the user's .profile AND the cron'ed script. Make sure that this sourced script has no return or exit statement because this becomes part of the foreground process and so an exit from the sourced script is an exit from the entire process.
If it ain't broke, I can fix that.
Jeff Schussele
Honored Contributor

Re: What the shell is going on?

Hi,

If the cronlog shows the jobs ARE starting then I'd suggest you put a
set -x
up top for good ole debugging purposes.

Rgds,
Jeff
PERSEVERANCE -- Remember, whatever does not kill you only makes you stronger!
jason thompson_1
Frequent Advisor

Re: What the shell is going on?

They are using /usr/bin/ksh, there is not now, or was there, a /etc/shells file. The cron job utilizes a modem connected to a mux. All users can access the modem without problem, but when cron tries to execute the job it will start and then fail to access the modem. If a users executes the same command that is in cron, it works without problem.
What's that smell?
jason thompson_1
Frequent Advisor

Re: What the shell is going on?

It works! Thanks Clay. The problem was that /usr/local/bin was not part of the path. If you reply I can add the appropriate points to your response.
What's that smell?
A. Clay Stephenson
Acclaimed Contributor
Solution

Re: What the shell is going on?

Good for you but I don't need no extra points. Sourcing an extra file in cronjobs, rc.d scripts, and in .profiles is a really good way to keep environments sane so that there is one place to make a change.


Regards, Clay
If it ain't broke, I can fix that.
Sorrel G. Jakins
Valued Contributor

Re: What the shell is going on?

Jason Thompson, on behalf of the Points Police I award you the Good Citizen Commendation.