Charles_Shaffer | 28 Jun 2012 18:19

[U2] Problem running script from crontab

Having a problem running a Unix script from the crontab.  We use Redhat 
and Unidata 7.1

This script runs fine from command line

UDTHOME=/NTN/CMI
export UDTHOME
UDTBIN=/usr/ud/bin
export UDTBIN
CMIHOME=/NTN/CMI/TRANS4M
export CMIHOME
PATH=$PATH: <at> UDTBIN
export PATH
cd /NTN/DATA/PRODUCTION
$UDTBIN/udt PHANTOM REQIMPORT_MA

But when it is run by the cron it doesn't seem to run.  We do a lot of 
this sort of thing here, but I have never tried running a script that used 
a PHANTOM command like this.  Does anyone see anything obvious here that 
would not let this run from cron?

Charles Shaffer
Senior Analyst
NTN-Bower Corporation
_______________________________________________
U2-Users mailing list
U2-Users <at> listserver.u2ug.org
http://listserver.u2ug.org/mailman/listinfo/u2-users

(Continue reading)

Jeff Schasny | 28 Jun 2012 18:53
Picon

Re: [U2] Problem running script from crontab

Are you running it at the command line as the same user that it runs 
under in cron?

Charles_Shaffer <at> ntn-bower.com wrote:
> Having a problem running a Unix script from the crontab.  We use Redhat 
> and Unidata 7.1
>
> This script runs fine from command line
>
> UDTHOME=/NTN/CMI
> export UDTHOME
> UDTBIN=/usr/ud/bin
> export UDTBIN
> CMIHOME=/NTN/CMI/TRANS4M
> export CMIHOME
> PATH=$PATH: <at> UDTBIN
> export PATH
> cd /NTN/DATA/PRODUCTION
> $UDTBIN/udt PHANTOM REQIMPORT_MA
>
> But when it is run by the cron it doesn't seem to run.  We do a lot of 
> this sort of thing here, but I have never tried running a script that used 
> a PHANTOM command like this.  Does anyone see anything obvious here that 
> would not let this run from cron?
>
> Charles Shaffer
> Senior Analyst
> NTN-Bower Corporation
> _______________________________________________
> U2-Users mailing list
(Continue reading)

George Gallen | 28 Jun 2012 19:19

Re: [U2] Problem running script from crontab

Make sure any commands referenced in your script, use the full pathname. I've had problems sometimes
Where the process doesn't have the same path names as when I tested it.

Ex.  Instead of cp , use /bin/cp

Sudo has this issue as well

George

-----Original Message-----
From: u2-users-bounces <at> listserver.u2ug.org [mailto:u2-users-bounces <at> listserver.u2ug.org] On
Behalf Of Jeff Schasny
Sent: Thursday, June 28, 2012 12:54 PM
To: U2 Users List
Subject: Re: [U2] Problem running script from crontab

Are you running it at the command line as the same user that it runs 
under in cron?

Charles_Shaffer <at> ntn-bower.com wrote:
> Having a problem running a Unix script from the crontab.  We use Redhat 
> and Unidata 7.1
>
> This script runs fine from command line
>
> UDTHOME=/NTN/CMI
> export UDTHOME
> UDTBIN=/usr/ud/bin
> export UDTBIN
> CMIHOME=/NTN/CMI/TRANS4M
(Continue reading)

Charles_Shaffer | 28 Jun 2012 19:18

Re: [U2] Problem running script from crontab

Jeff
>>Are you running it at the command line as the same user that it runs 
>>under in cron?

Yes I am.

Charles Shaffer
Senior Analyst
NTN-Bower Corporation

From:   Jeff Schasny <jschasny <at> gmail.com>
To:     U2 Users List <u2-users <at> listserver.u2ug.org>, 
Date:   06/28/2012 11:54 AM
Subject:        Re: [U2] Problem running script from crontab
Sent by:        u2-users-bounces <at> listserver.u2ug.org

Charles_Shaffer <at> ntn-bower.com wrote:
> Having a problem running a Unix script from the crontab.  We use Redhat 
> and Unidata 7.1
>
> This script runs fine from command line
>
> UDTHOME=/NTN/CMI
> export UDTHOME
> UDTBIN=/usr/ud/bin
> export UDTBIN
> CMIHOME=/NTN/CMI/TRANS4M
> export CMIHOME
> PATH=$PATH: <at> UDTBIN
> export PATH
(Continue reading)

Israel, John R. | 28 Jun 2012 19:22

Re: [U2] Problem running script from crontab

Each user CAN have their own crontab.  Login as this user and manually step through each command in your
script and see where it falls apart.

JRI

-----Original Message-----
From: u2-users-bounces <at> listserver.u2ug.org [mailto:u2-users-bounces <at> listserver.u2ug.org] On
Behalf Of Jeff Schasny
Sent: Thursday, June 28, 2012 12:54 PM
To: U2 Users List
Subject: Re: [U2] Problem running script from crontab

Are you running it at the command line as the same user that it runs under in cron?

Charles_Shaffer <at> ntn-bower.com wrote:
> Having a problem running a Unix script from the crontab.  We use 
> Redhat and Unidata 7.1
>
> This script runs fine from command line
>
> UDTHOME=/NTN/CMI
> export UDTHOME
> UDTBIN=/usr/ud/bin
> export UDTBIN
> CMIHOME=/NTN/CMI/TRANS4M
> export CMIHOME
> PATH=$PATH: <at> UDTBIN
> export PATH
> cd /NTN/DATA/PRODUCTION
> $UDTBIN/udt PHANTOM REQIMPORT_MA
(Continue reading)

Charles_Shaffer | 28 Jun 2012 19:56

Re: [U2] Problem running script from crontab

John
>>Each user CAN have their own crontab.  Login as this user and manually 
step through each command in your script and see where it falls apart.

>>JRI

I am using our master user cmi.  When I log in as cmi and type in the 
command that is in the crontab entry, from cmi's home directory, it runs 
with no problems. But when I wait for the cmi's cron to run it, nothing 
happens.  We want it to run every tem minutes.  Here is the line from the 
crontab.

# Requisition Imports from MP2
*/10 * * * * /NTN/DATA/PRODUCTION/SCRIPTS_MODS/ReqImp_MA

Is the */10 correct for RedHat?  I've never setup a job to run every 10 
minutes like this.  5,15,25,35,45,55 didn't work either.

Charles Shaffer
Senior Analyst
NTN-Bower Corporation

From:   "Israel, John R." <JohnIsrael <at> daytonsuperior.com>
To:     'U2 Users List' <u2-users <at> listserver.u2ug.org>, 
Date:   06/28/2012 12:22 PM
Subject:        Re: [U2] Problem running script from crontab
Sent by:        u2-users-bounces <at> listserver.u2ug.org

Each user CAN have their own crontab.  Login as this user and manually 
step through each command in your script and see where it falls apart.
(Continue reading)

Mark Eastwood | 28 Jun 2012 19:19

Re: [U2] Problem running script from crontab

If this was UniVerse, I would check the VOC LOGIN paragraph and make sure it's not invoking a menu (or
something) requiring an Input

Mark

> Having a problem running a Unix script from the crontab.  We use 
> Redhat and Unidata 7.1
>
> This script runs fine from command line
>
> UDTHOME=/NTN/CMI
> export UDTHOME
> UDTBIN=/usr/ud/bin
> export UDTBIN
> CMIHOME=/NTN/CMI/TRANS4M
> export CMIHOME
> PATH=$PATH: <at> UDTBIN
> export PATH
> cd /NTN/DATA/PRODUCTION
> $UDTBIN/udt PHANTOM REQIMPORT_MA
>
> But when it is run by the cron it doesn't seem to run.  We do a lot of 
> this sort of thing here, but I have never tried running a script that 
> used a PHANTOM command like this.  Does anyone see anything obvious 
> here that would not let this run from cron?
>
> Charles Shaffer
> Senior Analyst
> NTN-Bower Corporation

(Continue reading)

Charles_Shaffer | 28 Jun 2012 21:09

Re: [U2] Problem running script from crontab

>>> If this was UniVerse, I would check the VOC LOGIN paragraph and make 
sure it's not invoking a menu (or something) requiring an Input

>>> Mark

It is interesting that you said that.  The program that the script is 
calling does exactly that. It is calling menu programs from an ERP package 
and it is feeding the responses to it.  Working now.

Charles Shaffer
Senior Analyst
NTN-Bower Corporation
_______________________________________________
U2-Users mailing list
U2-Users <at> listserver.u2ug.org
http://listserver.u2ug.org/mailman/listinfo/u2-users

Tony Gravagno | 28 Jun 2012 19:10
Picon
Favicon

Re: [U2] Problem running script from crontab

Every time I see something like this it's a permissions issue.

> From: Charles_Shaffer
> 
> This script runs fine from command line...
> But when it is run by the cron it doesn't seem to run....

_______________________________________________
U2-Users mailing list
U2-Users <at> listserver.u2ug.org
http://listserver.u2ug.org/mailman/listinfo/u2-users

Larry Hiscock | 28 Jun 2012 19:27
Favicon

Re: [U2] Problem running script from crontab

Do you have LOGIN paragraph in your VOC file?  If you do, make sure you test
 <at> USER.TYPE and bypass anything that might require a prompt.  We run a dozen
different cron jobs multiple times per day on SCO & UD 6.

Larry Hiscock
Western Computer Services

-----Original Message-----
From: u2-users-bounces <at> listserver.u2ug.org
[mailto:u2-users-bounces <at> listserver.u2ug.org] On Behalf Of
Charles_Shaffer <at> ntn-bower.com
Sent: Thursday, June 28, 2012 9:19 AM
To: U2-Users <at> listserver.u2ug.org
Subject: [U2] Problem running script from crontab

Having a problem running a Unix script from the crontab.  We use Redhat and
Unidata 7.1

This script runs fine from command line

UDTHOME=/NTN/CMI
export UDTHOME
UDTBIN=/usr/ud/bin
export UDTBIN
CMIHOME=/NTN/CMI/TRANS4M
export CMIHOME
PATH=$PATH: <at> UDTBIN
export PATH
cd /NTN/DATA/PRODUCTION
$UDTBIN/udt PHANTOM REQIMPORT_MA
(Continue reading)

Bill Haskett | 28 Jun 2012 20:37
Favicon

Re: [U2] Problem running script from crontab

SCO!?

Bill

------------------------------------------------------------------------
----- Original Message -----
*From:* larryh <at> wcs-corp.com
*To:* 'U2 Users List' <u2-users <at> listserver.u2ug.org>
*Date:* 6/28/2012 10:27 AM
*Subject:* Re: [U2] Problem running script from crontab
> Do you have LOGIN paragraph in your VOC file?  If you do, make sure you test
>  <at> USER.TYPE and bypass anything that might require a prompt.  We run a dozen
> different cron jobs multiple times per day on SCO & UD 6.
>
> Larry Hiscock
> Western Computer Services
>
>
> -----Original Message-----
> From: u2-users-bounces <at> listserver.u2ug.org
> [mailto:u2-users-bounces <at> listserver.u2ug.org] On Behalf Of
> Charles_Shaffer <at> ntn-bower.com
> Sent: Thursday, June 28, 2012 9:19 AM
> To: U2-Users <at> listserver.u2ug.org
> Subject: [U2] Problem running script from crontab
>
> Having a problem running a Unix script from the crontab.  We use Redhat and
> Unidata 7.1
>
> This script runs fine from command line
(Continue reading)

Charles_Shaffer | 28 Jun 2012 20:46

Re: [U2] Problem running script from crontab

Bill,

RedHat

Charles Shaffer
Senior Analyst
NTN-Bower Corporation
_______________________________________________
U2-Users mailing list
U2-Users <at> listserver.u2ug.org
http://listserver.u2ug.org/mailman/listinfo/u2-users

Larry Hiscock | 28 Jun 2012 21:33
Favicon

Re: [U2] Problem running script from crontab

LOL ... what can I say.  It's an older system that hasn't been updated in a
while.  We have a RedHat upgrade planned somewhere out on the horizon, but
in this economy?  Pfffftt...

Larry Hiscock
Western Computer Services

-----Original Message-----
From: u2-users-bounces <at> listserver.u2ug.org
[mailto:u2-users-bounces <at> listserver.u2ug.org] On Behalf Of Bill Haskett
Sent: Thursday, June 28, 2012 11:38 AM
To: U2 Users List
Subject: Re: [U2] Problem running script from crontab

SCO!?

Bill

------------------------------------------------------------------------
----- Original Message -----
*From:* larryh <at> wcs-corp.com
*To:* 'U2 Users List' <u2-users <at> listserver.u2ug.org>
*Date:* 6/28/2012 10:27 AM
*Subject:* Re: [U2] Problem running script from crontab
> Do you have LOGIN paragraph in your VOC file?  If you do, make sure 
> you test  <at> USER.TYPE and bypass anything that might require a prompt.  
> We run a dozen different cron jobs multiple times per day on SCO & UD 6.
>
> Larry Hiscock
> Western Computer Services
(Continue reading)

George Gallen | 28 Jun 2012 22:08

Re: [U2] Problem running script from crontab

Which version of RH?

-----Original Message-----
From: u2-users-bounces <at> listserver.u2ug.org [mailto:u2-users-bounces <at> listserver.u2ug.org] On
Behalf Of Larry Hiscock
Sent: Thursday, June 28, 2012 3:33 PM
To: 'U2 Users List'
Subject: Re: [U2] Problem running script from crontab

LOL ... what can I say.  It's an older system that hasn't been updated in a
while.  We have a RedHat upgrade planned somewhere out on the horizon, but
in this economy?  Pfffftt...

Larry Hiscock
Western Computer Services

-----Original Message-----
From: u2-users-bounces <at> listserver.u2ug.org
[mailto:u2-users-bounces <at> listserver.u2ug.org] On Behalf Of Bill Haskett
Sent: Thursday, June 28, 2012 11:38 AM
To: U2 Users List
Subject: Re: [U2] Problem running script from crontab

SCO!?

Bill

------------------------------------------------------------------------
----- Original Message -----
*From:* larryh <at> wcs-corp.com
(Continue reading)

Charles_Shaffer | 28 Jun 2012 22:17

Re: [U2] Problem running script from crontab

George.  RedHat 6.
Charles Shaffer
Senior Analyst
NTN-Bower Corporation
_______________________________________________
U2-Users mailing list
U2-Users <at> listserver.u2ug.org
http://listserver.u2ug.org/mailman/listinfo/u2-users

George Gallen | 28 Jun 2012 22:27

Re: [U2] Problem running script from crontab

Sorry, I was asking Larry.

Not sure if UD scales as well as UV, however, the UV we originally loaded on RH 7.2, installed just fine 
When we upgraded to RH 9.0, and also has been running just dandy when we upgraded to RHEL 5.

So, it's just hardware costs now.....and time to make sure it all went fine.

George

-----Original Message-----
From: u2-users-bounces <at> listserver.u2ug.org [mailto:u2-users-bounces <at> listserver.u2ug.org] On
Behalf Of Charles_Shaffer <at> ntn-bower.com
Sent: Thursday, June 28, 2012 4:17 PM
To: U2 Users List
Subject: Re: [U2] Problem running script from crontab

George.  RedHat 6.
Charles Shaffer
Senior Analyst
NTN-Bower Corporation
_______________________________________________
U2-Users mailing list
U2-Users <at> listserver.u2ug.org
http://listserver.u2ug.org/mailman/listinfo/u2-users
_______________________________________________
U2-Users mailing list
U2-Users <at> listserver.u2ug.org
http://listserver.u2ug.org/mailman/listinfo/u2-users

(Continue reading)

Charles_Shaffer | 28 Jun 2012 19:58

Re: [U2] Problem running script from crontab

>>> lARRY
>>> Do you have LOGIN paragraph in your VOC file?

Yes and it looks like this.

:AE VOC LOGIN
Top of "LOGIN" in "VOC", 13 lines, 195 characters.
*--: P
001: PA
002: UDT.OPTIONS 82 ON
003: UDT.OPTIONS 43 ON
004: UDT.OPTIONS 43 OFF
005: UDT.OPTIONS 19 ON
006: UDT.OPTIONS 22 ON
007: SP-ASSIGN Q1 HS
008: GN91ACC.X
009: SORT.TYPE 2
010: BASICTYPE 'p'
011: IF  <at> USER.TYPE # 0 THEN GOTO EOJ
012: LOGON.DRIVER
013: EOJ:
Bottom.
*--:
Charles Shaffer
Senior Analyst
NTN-Bower Corporation
_______________________________________________
U2-Users mailing list
U2-Users <at> listserver.u2ug.org
http://listserver.u2ug.org/mailman/listinfo/u2-users
(Continue reading)

Colin Alfke | 28 Jun 2012 19:31
Picon
Favicon

Re: [U2] Problem running script from crontab

The phantom command will run your login paragraph. Is it setup to allow this
process to go through? There should be something in the _PH_ file/folder for
when the cron fired off.

hth
Colin

-----Original Message-----
From: Charles_Shaffer 
Sent: June 28, 2012 10:19 AM
To: U2-Users <at> listserver.u2ug.org
Subject: [U2] Problem running script from crontab

Having a problem running a Unix script from the crontab.  We use Redhat and
Unidata 7.1

This script runs fine from command line

UDTHOME=/NTN/CMI
export UDTHOME
UDTBIN=/usr/ud/bin
export UDTBIN
CMIHOME=/NTN/CMI/TRANS4M
export CMIHOME
PATH=$PATH: <at> UDTBIN
export PATH
cd /NTN/DATA/PRODUCTION
$UDTBIN/udt PHANTOM REQIMPORT_MA

But when it is run by the cron it doesn't seem to run.  We do a lot of this
(Continue reading)

Charles_Shaffer | 28 Jun 2012 20:03

Re: [U2] Problem running script from crontab

>>> The phantom command will run your login paragraph. Is it setup to 
allow this
>>> process to go through? There should be something in the _PH_ 
file/folder for
>>> when the cron fired off.

>>> hth
>>> Colin

This is interesting.  There are files being created in the _PH_ directory 
for each run (they are 10 minutes) apart.  But they are empty. This means 
that something failed right off the bat right?

Charles Shaffer
Senior Analyst
NTN-Bower Corporation
_______________________________________________
U2-Users mailing list
U2-Users <at> listserver.u2ug.org
http://listserver.u2ug.org/mailman/listinfo/u2-users

Wols Lists | 29 Jun 2012 01:03
Picon

Re: [U2] Problem running script from crontab

On 28/06/12 19:03, Charles_Shaffer <at> ntn-bower.com wrote:
> This is interesting.  There are files being created in the _PH_ directory 
> for each run (they are 10 minutes) apart.  But they are empty. This means 
> that something failed right off the bat right?

Looks like it. Run the PHANTOM command from TCL. iirc it puts a header
in the output file recording the fact that it's starting, which means
the PHANTOM command itself even isn't getting a look-in.

Can you get crontab to record the output as it fires up? Put an output
redirect on the command? See if you're getting any errors to stderr?

Cheers,
Wol
_______________________________________________
U2-Users mailing list
U2-Users <at> listserver.u2ug.org
http://listserver.u2ug.org/mailman/listinfo/u2-users

Colin Alfke | 1 Jul 2012 02:23
Picon
Favicon

Re: [U2] Problem running script from crontab


Perhaps. Anything that would have gone to the screen will go to the _PH_ record (note: if it's firing every 10
minutes you will want to automate a process to clean up the records).
You could put some CRT's in your LOGIN/program process to track it better. From a previous note it looked
like the crontab item wasn't going properly (you could also put output into your crontab script so you
could see when it runs.
It could also be as simple as surrounding the statement in quotes as per a previous suggestion - we do on Windows.
Good luck
Colin

> From: Charles_Shaffer
> Date: Thu, 28 Jun 2012 13:03:37 -0500
> Subject: Re: [U2] Problem running script from crontab
> 
> >>> The phantom command will run your login paragraph. Is it setup to 
> allow this
> >>> process to go through? There should be something in the _PH_ 
> file/folder for
> >>> when the cron fired off.
> 
> >>> hth
> >>> Colin
> 
> This is interesting.  There are files being created in the _PH_ directory 
> for each run (they are 10 minutes) apart.  But they are empty. This means 
> that something failed right off the bat right?
> 
> Charles Shaffer

 		 	   		  
(Continue reading)

John Thompson | 1 Jul 2012 16:22
Picon

Re: [U2] Problem running script from crontab

Coming late to the party...

I did not see you sourcing your shell profile or unidata linux
environment variables in your first example you posted.  You have to
do this with cron as it is not a "full" shell environment.

When you login as a regular user and get a shell prompt, several
scripts are automatically referenced before you get a shell prompt.
Probably /etc/profile and /home/user/profile.

This is not the case with cron.  You must load up all the normal linux
shell environment variables plus what is needed to run unidata in
every script you run in cron.

I also noticed you were using korn shell.  The default shell in redhat
is bash unless configured otherwise.
It might be worth giving bash scripts a shot if you have weird behavior still...
#/bin/bash
        source /home/user/.bash_profile

Then in .bash_profile call the script that loads the unidata
environment variables.

That way you are getting everything for the user and unidata loaded
for a background process to run.

I have some examples I could send you if its still misbehaving.  Hope
that helps.

On 6/30/12, Colin Alfke <alfke121 <at> hotmail.com> wrote:
(Continue reading)

Jeff Schasny | 28 Jun 2012 19:32
Picon

Re: [U2] Problem running script from crontab

Not sure about Unidata, but our Universe scripts all have the string to 
be executed by the uv command in double quotes. You might try:

$UDTBIN/udt "PHANTOM REQIMPORT_MA"

Charles_Shaffer <at> ntn-bower.com wrote:
> Having a problem running a Unix script from the crontab.  We use Redhat 
> and Unidata 7.1
>
> This script runs fine from command line
>
> UDTHOME=/NTN/CMI
> export UDTHOME
> UDTBIN=/usr/ud/bin
> export UDTBIN
> CMIHOME=/NTN/CMI/TRANS4M
> export CMIHOME
> PATH=$PATH: <at> UDTBIN
> export PATH
> cd /NTN/DATA/PRODUCTION
> $UDTBIN/udt PHANTOM REQIMPORT_MA
>
> But when it is run by the cron it doesn't seem to run.  We do a lot of 
> this sort of thing here, but I have never tried running a script that used 
> a PHANTOM command like this.  Does anyone see anything obvious here that 
> would not let this run from cron?
>
> Charles Shaffer
> Senior Analyst
> NTN-Bower Corporation
(Continue reading)


Gmane