Re: Unix cron job - executing informix 4GL process
Posted in 2006
Topics: Connectivity: ESQL/C, 4GL & Embedded SQL
Adam Tauno Williams wrote: >> I am facing some problem while executing the process thru cron. My execution >> scripts (KORN shell) will be something as below: >[quoted text clipped - 3 lines] >> I execute the program manually thru command line,it is working fine. >> Anyone have any clue what cause the problem? > >When you execute it manually via a telnet/ssh session you probably have >a TERM value set, which defines that `tput kf9` outputs. When it runs >via CRON then TERM is possibly not set or set to some system default. > >Try - >(export TERM=vt100; echo U$(tput kf9)$(tput kf9)|/prog/bin/prog1.exe M >A) >/prog/log/cron.log Thank you for your response. we are using TERM=wy150. I have checked that and it is exported correctly. Any other clue to resolve this issue? -- Message posted via DBMonster.com http://www.dbmonster.com/Uwe/Forums.aspx/informix/200606/1
yy4 via DBMonster.com wrote: > Adam Tauno Williams wrote: >>> I am facing some problem while executing the process thru cron. My execution >>> scripts (KORN shell) will be something as below: >> [quoted text clipped - 3 lines] >>> I execute the program manually thru command line,it is working fine. >>> Anyone have any clue what cause the problem? >> When you execute it manually via a telnet/ssh session you probably have >> a TERM value set, which defines that `tput kf9` outputs. When it runs >> via CRON then TERM is possibly not set or set to some system default. >> >> Try - >> (export TERM=vt100; echo U$(tput kf9)$(tput kf9)|/prog/bin/prog1.exe M >> A) >/prog/log/cron.log > > Thank you for your response. > we are using TERM=wy150. I have checked that and it is exported correctly. > Any other clue to resolve this issue? Problems with running Informix programs via cron almost invariably boil down to environment in some extended sense of the term environment. Here, that could include current directory, uid, gid, aux gid, umask, tty device, and so on - as well as the environment variables. First step - analyze what environment variables are set in the working environment, from the command line. Second step - establish what environment variables are set in the cron environment. If the problem isn't obvious when you compare the two lists, then try eliminating variables from the command line environment, heading towards the simpler cron environment. If you get to identical environments and the problem still occurs, look at other aspects of the environment, such as uid, ... If you still have problems after reconciling all the environment, it is most likely something to do with the terminal handling - and the tty. Do ensure that you get the correct output from your echo command - pipe it through tee perhaps, to trap the output before sending it to the program. -- Jonathan Leffler #include <disclaimer.h> Email: jleffler@earthlink.net, jleffler@us.ibm.com Guardian of DBD::Informix v2005.02 -- http://dbi.perl.org/
Further analysis done, it is comfirm that the cause was due to the $(tput kf9) not pass to the calling 4GL program correctly. after a crontab log showing the following: stty: : Not a typewriter Any idea to resolve this? It seem like the cron process can't recognize the $(tput kf9) correctly. I am not the unix expert, but you please show me how to handle all these tput command and terminal setting handling especially in cron process. Jonathan Leffler wrote: >>>> I am facing some problem while executing the process thru cron. My execution >>>> scripts (KORN shell) will be something as below: >[quoted text clipped - 12 lines] >> we are using TERM=wy150. I have checked that and it is exported correctly. >> Any other clue to resolve this issue? > >Problems with running Informix programs via cron almost invariably boil >down to environment in some extended sense of the term environment. >Here, that could include current directory, uid, gid, aux gid, umask, >tty device, and so on - as well as the environment variables. > >First step - analyze what environment variables are set in the working >environment, from the command line. >Second step - establish what environment variables are set in the cron >environment. >If the problem isn't obvious when you compare the two lists, then try >eliminating variables from the command line environment, heading towards >the simpler cron environment. > >If you get to identical environments and the problem still occurs, look >at other aspects of the environment, such as uid, ... >If you still have problems after reconciling all the environment, it is >most likely something to do with the terminal handling - and the tty. >Do ensure that you get the correct output from your echo command - pipe >it through tee perhaps, to trap the output before sending it to the program. > -- Message posted via DBMonster.com http://www.dbmonster.com/Uwe/Forums.aspx/informix/200606/1
Just put it all in a script and run that script from cron instead... On Wednesday 28 June 2006 10:32, yy4 via DBMonster.com wrote: > Further analysis done, it is comfirm that the cause was due to the $(tput > kf9) not pass to the calling 4GL program correctly. > > after a crontab log showing the following: > stty: : Not a typewriter > > Any idea to resolve this? > It seem like the cron process can't recognize the $(tput kf9) correctly. > I am not the unix expert, but you please show me how to handle all these > tput command and terminal setting handling especially in cron process. -- Mike Aubury