- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- cron script not work .. tried everything!!
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-15-2001 04:08 PM
11-15-2001 04:08 PM
cron script not work .. tried everything!!
I have attached a file with 3 ways I have tried to run a script for a 3rd party app from our software vendor. The app is called swmaint. The issue is that we can only run this command on our maintance window because it brings down our whole system.Let me break down what is going on per script.
Script1:
It works thoguh cron the command line and though remsh shell. And this is what we wanna do!!
script2:
works though command line. But not though cron.
script3:
works though command line but not though cron.
script4:
works though command line but not though cron
does anyone have any ideas?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-15-2001 04:19 PM
11-15-2001 04:19 PM
Re: cron script not work .. tried everything!!
Richard
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-15-2001 04:20 PM
11-15-2001 04:20 PM
Re: cron script not work .. tried everything!!
Possible Fix 1)
surround everything that may be looking for a terminal with
if [ -t 0 -o -t 1 ]
then
terminal command here
fi
-t 0 (stdin) -t 1 (stdout)
Possible Fix 2 (better answer))
Have a config file which sets the stuff your need in a separate which must not have an exit statement. Then both your cron script and your .profile can source this file.
This still may not be enough. You may need to use an exec statement to redirect stdin, stdout, and/or stderr.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-15-2001 05:18 PM
11-15-2001 05:18 PM
Re: cron script not work .. tried everything!!
You would be logged in as root when you submit the job to cron, right?
After cron triggers script 3, does the file /eteam/reconfig/reconf.log
contain "reconfig started" ?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-15-2001 05:39 PM
11-15-2001 05:39 PM
Re: cron script not work .. tried everything!!
richard
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-15-2001 07:21 PM
11-15-2001 07:21 PM
Re: cron script not work .. tried everything!!
Also, if you redirect the stdout & stderr to the same log file, it should be helpful. I'd hate to see a '/usr/sbin/ unreadable ' message in the logfile! :)

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-16-2001 12:30 AM
11-16-2001 12:30 AM
Re: cron script not work .. tried everything!!
Put on some loggin and source your .profile (cd . ./home/username/.profile)
check out the results.
Gideon
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-16-2001 01:56 AM
11-16-2001 01:56 AM
Re: cron script not work .. tried everything!!
check interactively, if your command works when TERM is not set (I had this with ADABAS D database tools).
Script 1 sets TERM !
Script 2 sets TERM, but excutes .profile afterwards, and maybe resets it (swap the lines and check) !
Script 3 and 4 do not set TERM !
That is the most obvious diffrence I found.
Hope this helps.
Volker
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-16-2001 05:20 AM
11-16-2001 05:20 AM
Re: cron script not work .. tried everything!!
In all scripts don't set term variable, set it in /.profile only and execute . /.profile in all scripts. I feel it will work bcos as soon as u r executing . /.profile previous settings of TERM variable are resetting.
And also recheck ur cron entries.
Cheers...
Satish.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-16-2001 05:59 AM
11-16-2001 05:59 AM
Re: cron script not work .. tried everything!!
Also it looks like some path settings need to be added to the script. Cron doesn't always source in .profile or .cshrc
Another thing could be that the scripts needs to write out to a device so maybe add > /dev/null or something like that.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-16-2001 08:13 AM
11-16-2001 08:13 AM
Re: cron script not work .. tried everything!!
Richard
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-16-2001 11:24 AM
11-16-2001 11:24 AM
Re: cron script not work .. tried everything!!
I suspect a env var is the cause. Try this:
I the script, redirect you environment to see what is different from the shell and the cron.
Something like
env > /tmp/script2_cron_env.txt
Then run it from the cron.
Then change it to read
env > /tmp/script2_shell_env.txt
Then run it from command line.
Look and see what the differences are????
I bet you will find your answer.
If you can run it from the command line, you can run it from the cron.
...jcd...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-16-2001 11:44 AM
11-16-2001 11:44 AM
Re: cron script not work .. tried everything!!
most definitely something in your environment is different from cron. Remember cron has a very limited number of environment variables set. full pathnames should always be used. Someone suggested doing a cron job to output what the "env" variables are, and then do an "env" in your login to see what the differences are, especially the PATH (order counts).
live free or die
harry