Friends,
Please need your help....
How can i run .sh file inside the vi editor in backend in HP Unix.
Friends,
Please need your help....
How can i run .sh file inside the vi editor in backend in HP Unix.
You can make use of
:! sh your_script.sh
ensure that script is having proper permission.
Thanks ....
If the sh file execution takes more time i.e 30 min then how can i continue work on same vi editor.
So need ur suggestion for run the sh file inside vi for "backend execution".
:! nohup your_script.sh &
Thanks it's working fine...
How can i see the job is running or not in the backend inside the same vi ?
Please suggest..
:! fuser nohup.out
(assuming fuser is available under HPUX) should show you if the process is still running.
:! ps
Thanks ...
but it is not displaying the exact .sh file name which is running in backend.So it's difucult to identify.
Please suggest...
What about my "fuser" suggestion ? Did you try it ?
Okay, lets show more detail:
:! ps -f
Ps: Have you considered starting mutiple telnet sessions?
Outside the vi we all are using "jobs" for this.
Your code :!ps -f is showing the commands firing at that time which is present inside the sh file but no sh file displaying which is running in backend.
---------- Post updated at 12:15 PM ---------- Previous update was at 12:12 PM ----------
Hi,
fuser is not available ... So m unable to try it.
It should, although not in the default PATH. Try:
:!/usr/sbin/fuser nohup.out
or
:!/etc/fuser nohup.out
Hi,
Thanks .....
Only this output comes :
nohup.out: 1234o 2345o
but still m unable to find out the sh file name.
Need your help...
You question was:
As long as you have process IDs shown after the nohup.out file, your background job is running.
If you want to double check these processes are the correct ones, you can run:
:!ptree $(pfiles nohup.out)
at least on HP-UX 11i.
Otherwise, you can use ps with passing the pids (1234 and 2345 in your example) ignore the "o" which means used as output.
What Operating System and version you you have? (uname -a).
The "ps -f" shows all processes running in foreground or background which were started from that terminal.
What does "... running in backend" mean?
Can you show an example of what you type and what actually happens?
@jlliagre
In HP-UX 11i the permissions on "fuser" are 644 bin bin. Also there is no "ptree" command.
This is quite unfortunate. Is it a bug on your system or by design ?
Can you double check that. It seems it has been documented on HP-UX since at least 1993 and the open poster has ptree available.
@jlliagre
I stand corrected. Looks like "ptree" "pgrep" and "pkill" were finally available in HP-UX 11.23. They were missing in 11.00 and 11.11 and I wrote my own scripts with the functionality I missed.
The "fuser" on HP-UX is weird because part of the output is directed to STDERR. This makes the output fiddly to process in Shell. There seems to be no rational reason for the permissions but they are standard issue.
To get just the Process Id's:
/usr/sbin/fuser filename 2>/dev/null
I suspect from having used HP-UX for a while now that the reason
part of the outptut goes to STDERR instead of all to STDOUT or STDERR is so you can do as Methyl points out:
/usr/sbin/fuser filename 2>/dev/null
And get just the PID.
I still remember way back when trying to get fuser output through a pipe and failing miserably! :wall:
This useful feature isn't HP-UX specific. There is no need to filter out the pids thanks to it. As long as ptree is available and accept a list of pids, the command I suggested should work just fine precisely because the stdout/stderr split:
ptree $(pfiles nohup.out)
[quote=methyl;302485764]
What Operating System and version you you have? (uname -a).
The "ps -f" shows all processes running in foreground or background which were started from that terminal.
What does "... running in backend" mean?
Can you show an example of what you type and what actually happens?
Hi ,
Thanks a lot atlast i got it.
U r right :!ps -f command is OK.
I have tried in another terminal and found the sh file name.
Backend ---> Background
Also thanks to jlliagre ...