Operating System - HP-UX
1748169 Members
4374 Online
108758 Solutions
New Discussion юеВ

Re: Shell script "threads"

 
SOLVED
Go to solution
Don Bentz
Regular Advisor

Shell script "threads"

We run scripts that execute Oracle SQLs, most of them with multiple "steps". It seems there are cases where a 'ps -ef' will show the "shell script" and sometimes not, even though one of it's "steps" (SQL Scripts) are executing. Suffice it to say I find it a little difficult to follow the thread when a programmer asks me to kill the "shell script" but they don't know what "step" it's in.
Insecurity is our friend. It keeps you dependent.
9 REPLIES 9
Fred Ruffet
Honored Contributor

Re: Shell script "threads"

is the SQL script is a subprocess from shell script, then shell script can't "disappear" while SQL still running.

In order not to miss the shell, you can use this command : "UNIX95=true ps -AH -o user,pid,args" which will show you processes in a tree form. You can use grep to get only processes hold by the user you want.

Regards,

Fred
--

"Reality is just a point of view." (P. K. D.)
Don Bentz
Regular Advisor

Re: Shell script "threads"

Fred-
Well, I suppose I should have been more specific. According to the "man" pages for "ps" the -A and -H options are only valid for XPG4. I am certain that your solution would work swell in such a case. To be honest with you, I don't even know what XPG4 is, but I do know that I get an error when I try to use these options. I am on HPUX 11.00
Insecurity is our friend. It keeps you dependent.
Jean-Luc Oudart
Honored Contributor

Re: Shell script "threads"

I have HPUX 11.0 and I have no problem running the command
UNIX95= ps -AH -o user,pid,args | grep

Regards
Jean-Luc
fiat lux
Don Bentz
Regular Advisor

Re: Shell script "threads"

# UNIX95=`ps -AH -o user,pid,args | grep sched`
ps: illegal option -- A
ps: illegal option -- H
ps: illegal option -- o
usage: ps [-edaflPx] [-u ulist] [-g glist] [-p plist] [-t tlist] [-R prmgroup]

Perhaps mistakenly I removed the spaces and replaced them with "back tics",
But thanks anyway.
Insecurity is our friend. It keeps you dependent.
Jean-Luc Oudart
Honored Contributor

Re: Shell script "threads"

no backquote !!!
just a space between UNIX95= and ps command

Regards
Jean-Luc
fiat lux
Don Bentz
Regular Advisor

Re: Shell script "threads"

So, what is "UNIX95". I can't find a man page for it and "which" returns nothing. That construct looked like an "assign" to me(?).
Insecurity is our friend. It keeps you dependent.
Jean-Luc Oudart
Honored Contributor
Solution

Re: Shell script "threads"

Fred Ruffet
Honored Contributor

Re: Shell script "threads"

I made it a little short maybe :)

Switching in XPG4 mode can be done by setting UNIX95 env variable to anything you want (for exemple to "true").

In Unix, you can do the following :
. Have a var defined for your shell, using "UNIX95=true"on a single line.
. Have a var defined for your shell and sub-shells, using "export UNIX95=true" on a single line
. Have a var defined only for the current command, using "UNIX95=true whatevercommandyouwant".

I used the last one. So you have to do exactly the following :
UNIX95=true ps -AH -o user,pid,args
(note the space between "UNIX95=true" and "ps".)

I only set UNIX95 for this command, because this XPG4 environment has consequences for many commands and I don't want your environment to be changed.

Regards,

Fred
--

"Reality is just a point of view." (P. K. D.)
Don Bentz
Regular Advisor

Re: Shell script "threads"

Fred - thanks for the reply.
Insecurity is our friend. It keeps you dependent.