Operating System - HP-UX
1752449 Members
6076 Online
108788 Solutions
New Discussion юеВ

Re: 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 3
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

.