Operating System - HP-UX
1820592 Members
1670 Online
109626 Solutions
New Discussion юеВ

Job execution through Xming

 
SOLVED
Go to solution
panchpan
Regular Advisor

Job execution through Xming

Hello,
Every evening I run few shell scripts on HP-UX Production Box, One shell script takes about one hour to complete and does some DB updation and application processing etc. The shell scripts are getting launched from prompt and not through cron or any scheduler as they require some manual inputs during execution.

I was thinking IF these shell scripts could be launched from Xming or any other xwindows tool instead of a normal emulator like putty or telnet etc. Will that benefit me incase network wire gets unplugged or by mistake I close putty window etc. I mean, will there be any benefit by running shells from Xming type of tool than running directly on production prompt? I have heard that running such things on xwindows emulator will run the job on production and accept manual input also plus during network intermittance will have no affect.

Please let me know your feedback.

Thank you
5 REPLIES 5
OldSchool
Honored Contributor

Re: Job execution through Xming

as far as I know, the answer would be that it would not have any benefit. a disconnect is a disconnect.

Now, if the reponses to the prompts are always the same, or are known in advance, then a "here-doc" or "expect" might be of some use. in that case you could prepare a script and run it w/ nohup or from cron
Michael Steele_2
Honored Contributor

Re: Job execution through Xming

I was thinking the same thing that OldSchool suggested. Use here-docs and nohup. Update the script file nightly if you know the new values in advance, else, if you're relying on the values to be provided real time then capture the new values in a variable embedded within the here-doc. Here's an example here-doc w/out a variable:

/usr/sbin/cstm<<-EOF (* EOF marks start of here-doc *)
runutil logtool (* command *)
rs (* command *)
EOF (* EOF also marks the end of here-doc *)
Support Fatherhood - Stop Family Law
panchpan
Regular Advisor

Re: Job execution through Xming

Hello - Thank you for your reply. I will study on given option. Meanwhile, will xming type of emulator benefit me in scenario consider the network plug is unplugged of my workstation and the job was running in xming. Whereas incase of normal Putty - its completely gone and perhaps in case of xming - its not gone by unplugging the network cable. I am not sure - Please comment.
panchpan
Regular Advisor

Re: Job execution through Xming

Actually the piece (example) of code what I have in my shell scripts are :
-------------------------------------------------------------------------
echo "\nYou are about to run DB Backup Process. Continue (yes/no)? \c"
read ans
case "$ans" in
[Yy]*)
break
;;
*)
exit 0
;;
esac
$BIN/BKUP.SH -n $BIN/DB_BKUP.tar # This shell copies a .tar file to some other server
$BIN/mpro /home/bases/proddb -pf bkup.pf -p ag/dbbkup.r # Calls another non-unix source program which actually does the process and asks for UserID and password
---------------------------------------


Question:
1) How to convert yes/no part with expect or heredoc? I mean, Do I need to modify the entire scripts or I could just write a heredoc script and then call the regular scripts?
2) How will expect/heredoc manage IF the script is calling some other application source codes?
Matti_Kurkela
Honored Contributor
Solution

Re: Job execution through Xming

A MS-Windows-based X-server like Xming alone does *not* give you the kind of protection from disconnections you're seeking.

For that, you'll need something like the "screen" utility:
http://hpux.cs.utah.edu/hppd/hpux/Sysadmin/screen-4.0.3/

Basically, before starting the shell script, run "screen". It creates a "shell within a shell". Then run the script as normal. If the network connection fails while the script is running, the outer shell will disconnect but the inner shell that's running the script, protected by the screen utility, will remain.

After the network failure has been corrected, you can login again to the same user account, and run "screen -R" to resume controlling the script.

This is a very basic way to use the screen utility; there is a lot more functionality in it. Read the man page of the screen utility for more information.

MK
MK