HPE Community read-only access December 15, 2018
This is a maintenance upgrade. You will be able to read articles and posts, but not post or reply.
Hours:
Dec 15, 4:00 am to 10:00 am UTC
Dec 14, 10:00 pm CST to Dec 15, 4:00 am CST
Dec 14, 8:00 pm PST to Dec 15, 2:00 am PST
cancel
Showing results for 
Search instead for 
Did you mean: 

Problems with CRON in HP-UX

 
SOLVED
Go to solution
Roman Sustek
Occasional Contributor

Problems with CRON in HP-UX

Hi,

I've run into problems with CRON. I want to schedule a script to run at a certain time. But some commands don't return any output. I don't understand this behaviour. Here's an example

an example of the script is:
#!/bin/sh
echo date
date
echo autorep
autorep (this is a command of autosys application)

When I run the script normally I get:
$./test.sh
date
Tue May 17 18:33:30 EDT 2011
autorep
Usage: [-J JobName] <-d | -s | -q | -o
...

when I schedule it in cron like this:
0-59 * * * * /home/.../test.sh > out

I get :
$cat out
date
Tue May 17 18:35:00 EDT 2011
autorep


There's no output of autorep. not even some error e.g.: No such file or directory. Does anyone have an idea what might be causing it?
3 REPLIES
James R. Ferguson
Acclaimed Contributor
Solution

Re: Problems with CRON in HP-UX

Hi:

The 'cron' environment is very sparse. First, you need to use absolute paths. By default your environment consists of:

HOME=userâ s-home-directory
LOGNAME=userâ s-login-id
PATH=/usr/bin:/usr/sbin:.
SHELL=/usr/bin/sh

Hence unless you 'source' (read) your '.profile' nothing that you normally expect to have during an interactive shell session will exist. I advise you *not* to invoke your ';profile' but rather provide what you need in your cron'ed script. It appears that this is quite minimal.

Regards!

...JRF...
Roman Sustek
Occasional Contributor

Re: Problems with CRON in HP-UX

Thanks, now it works ;)
Roman Sustek
Occasional Contributor

Re: Problems with CRON in HP-UX

.