Operating System - HP-UX
1837390 Members
3396 Online
110116 Solutions
New Discussion

problem from process running in background

 
SOLVED
Go to solution
N Gopal
Frequent Advisor

problem from process running in background

Hi,

Today i executed one scripts(.scr)which will generate reports(.csv file).

i run in this way

abc.scr &
it means i will run in backgound.
This script runs while loop and once records are over it teminates. It generates one CSV file as output.

I observed that this script is not getting terminated and cntinuously generatin records.
Files size is incerasing like anything. Actually it should process only 100 items.
Is any way to identify and kill this process?

Thanks
4 REPLIES 4
Hemmetter
Esteemed Contributor
Solution

Re: problem from process running in background

Hi

if you start your script in backgroud
you get some job-id

$ abc.scr &
[1]

$ now you can
$ kill %1


or
$ ps -ef | grep abc.scr

$ kill $the-pid-you-see


Or you can save the pid into a pidfile for later reference:

$ abc.scr &
$ echo $! >/tmp/abc.scr.pid
$ ps -fp $(/tmp/abc.scr.pid)
$ do-something-else
$
$ kill $(cat /tmp/abc.scr.pid)

But better you debug why your loop does not terminate. What kind of loop is there in your script?

rgds
HGH


Hemmetter
Esteemed Contributor

Re: problem from process running in background

Hi

see your background jobs with:

$ jobs
[1] running abc.scr &
[2] running efg.scr &

$ kill %1



rgds
HGH

N Gopal
Frequent Advisor

Re: problem from process running in background

Hi Hem,

Thanks a lot problem got resolved. I killed the processes.

Thanks
Dennis Handly
Acclaimed Contributor

Re: problem from process running in background

You can also use "jobs -l" to get the PIDs.

You can also get a nice hierarchal listing of all of your processes with:
$ UNIX95= ps -Hfu $LOGNAME