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 alfke...@hotmail.com wrote: 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 ___ U2-Users mailing list U2-Users@listserver.u2ug.org http://listserver.u2ug.org/mailman/listinfo/u2-users -- Sent from my mobile device John Thompson ___ U2-Users mailing list U2-Users@listserver.u2ug.org http://listserver.u2ug.org/mailman/listinfo/u2-users
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 ___ U2-Users mailing list U2-Users@listserver.u2ug.org http://listserver.u2ug.org/mailman/listinfo/u2-users
[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:@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@listserver.u2ug.org http://listserver.u2ug.org/mailman/listinfo/u2-users
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_shaf...@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:@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@listserver.u2ug.org http://listserver.u2ug.org/mailman/listinfo/u2-users -- Jeff Schasny - Denver, Co, USA jschasny at gmail dot com ___ U2-Users mailing list U2-Users@listserver.u2ug.org http://listserver.u2ug.org/mailman/listinfo/u2-users
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@listserver.u2ug.org http://listserver.u2ug.org/mailman/listinfo/u2-users
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-boun...@listserver.u2ug.org [mailto:u2-users-boun...@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_shaf...@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:@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@listserver.u2ug.org http://listserver.u2ug.org/mailman/listinfo/u2-users -- Jeff Schasny - Denver, Co, USA jschasny at gmail dot com ___ U2-Users mailing list U2-Users@listserver.u2ug.org http://listserver.u2ug.org/mailman/listinfo/u2-users ___ U2-Users mailing list U2-Users@listserver.u2ug.org http://listserver.u2ug.org/mailman/listinfo/u2-users
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 jscha...@gmail.com To: U2 Users List u2-users@listserver.u2ug.org, Date: 06/28/2012 11:54 AM Subject:Re: [U2] Problem running script from crontab Sent by:u2-users-boun...@listserver.u2ug.org charles_shaf...@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:@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@listserver.u2ug.org http://listserver.u2ug.org/mailman/listinfo/u2-users -- Jeff Schasny - Denver, Co, USA jschasny at gmail dot com ___ U2-Users mailing list U2-Users@listserver.u2ug.org http://listserver.u2ug.org/mailman/listinfo/u2-users ___ U2-Users mailing list U2-Users@listserver.u2ug.org http://listserver.u2ug.org/mailman/listinfo/u2-users
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-boun...@listserver.u2ug.org [mailto:u2-users-boun...@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_shaf...@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:@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@listserver.u2ug.org http://listserver.u2ug.org/mailman/listinfo/u2-users -- Jeff Schasny - Denver, Co, USA jschasny at gmail dot com ___ U2-Users mailing list U2-Users@listserver.u2ug.org http://listserver.u2ug.org/mailman/listinfo/u2-users ___ U2-Users mailing list U2-Users@listserver.u2ug.org http://listserver.u2ug.org/mailman/listinfo/u2-users
Re: [U2] Problem running script from crontab
Do you have LOGIN paragraph in your VOC file? If you do, make sure you test @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-boun...@listserver.u2ug.org [mailto:u2-users-boun...@listserver.u2ug.org] On Behalf Of charles_shaf...@ntn-bower.com Sent: Thursday, June 28, 2012 9:19 AM To: U2-Users@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:@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@listserver.u2ug.org http://listserver.u2ug.org/mailman/listinfo/u2-users ___ U2-Users mailing list U2-Users@listserver.u2ug.org http://listserver.u2ug.org/mailman/listinfo/u2-users
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@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:@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 ___ U2-Users mailing list U2-Users@listserver.u2ug.org http://listserver.u2ug.org/mailman/listinfo/u2-users
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 @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@listserver.u2ug.org http://listserver.u2ug.org/mailman/listinfo/u2-users
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@listserver.u2ug.org http://listserver.u2ug.org/mailman/listinfo/u2-users
[U2] Problem running script from crontab
I rewrote the script to use our in-house methods and now it is working. #!/bin/ksh echo `date` FILES_LOG/ReqImp.LOG . /usr/local/set_udt_environ.scr cd /NTN/DATA/PRODUCTION $UDTBIN/udtEODFILES_LOG/ReqImp.LOG PHANTOM REQIMPORT_MA bye EOD Still not sure why it was failing before, but I am moving on. Thanks for your help everyone. Charles Shaffer Senior Analyst NTN-Bower Corporation ___ U2-Users mailing list U2-Users@listserver.u2ug.org http://listserver.u2ug.org/mailman/listinfo/u2-users
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@listserver.u2ug.org http://listserver.u2ug.org/mailman/listinfo/u2-users
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? Ptt... Larry Hiscock Western Computer Services -Original Message- From: u2-users-boun...@listserver.u2ug.org [mailto:u2-users-boun...@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:* lar...@wcs-corp.com *To:* 'U2 Users List' u2-users@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 @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-boun...@listserver.u2ug.org [mailto:u2-users-boun...@listserver.u2ug.org] On Behalf Of charles_shaf...@ntn-bower.com Sent: Thursday, June 28, 2012 9:19 AM To: U2-Users@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:@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@listserver.u2ug.org http://listserver.u2ug.org/mailman/listinfo/u2-users ___ U2-Users mailing list U2-Users@listserver.u2ug.org http://listserver.u2ug.org/mailman/listinfo/u2-users
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:@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@listserver.u2ug.org http://listserver.u2ug.org/mailman/listinfo/u2-users
Re: [U2] Problem running script from crontab
Which version of RH? -Original Message- From: u2-users-boun...@listserver.u2ug.org [mailto:u2-users-boun...@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? Ptt... Larry Hiscock Western Computer Services -Original Message- From: u2-users-boun...@listserver.u2ug.org [mailto:u2-users-boun...@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:* lar...@wcs-corp.com *To:* 'U2 Users List' u2-users@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 @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-boun...@listserver.u2ug.org [mailto:u2-users-boun...@listserver.u2ug.org] On Behalf Of charles_shaf...@ntn-bower.com Sent: Thursday, June 28, 2012 9:19 AM To: U2-Users@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:@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@listserver.u2ug.org http://listserver.u2ug.org/mailman/listinfo/u2-users ___ U2-Users mailing list U2-Users@listserver.u2ug.org http://listserver.u2ug.org/mailman/listinfo/u2-users ___ U2-Users mailing list U2-Users@listserver.u2ug.org http://listserver.u2ug.org/mailman/listinfo/u2-users
Re: [U2] Problem running script from crontab
George. RedHat 6. Charles Shaffer Senior Analyst NTN-Bower Corporation ___ U2-Users mailing list U2-Users@listserver.u2ug.org http://listserver.u2ug.org/mailman/listinfo/u2-users
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-boun...@listserver.u2ug.org [mailto:u2-users-boun...@listserver.u2ug.org] On Behalf Of charles_shaf...@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@listserver.u2ug.org http://listserver.u2ug.org/mailman/listinfo/u2-users ___ U2-Users mailing list U2-Users@listserver.u2ug.org http://listserver.u2ug.org/mailman/listinfo/u2-users
Re: [U2] Problem running script from crontab
On 28/06/12 19:03, charles_shaf...@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@listserver.u2ug.org http://listserver.u2ug.org/mailman/listinfo/u2-users