Post Reply 
 
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
finding a process id
06-23-2018, 05:59 AM
Post: #1
finding a process id
Sometimes it is necessary to kioll a running process. This is not easy if the process id has not been saved. The following program finds the process id from the shell. I call the program:

pid

Code:
#!yab
program$=peek$("argument")
program$=trim$(program$)
if program$="" then
    print "usage:  pid  programname"
    exit
endif
a$=system$("ps "+program$)
dim w$(1)
num=token(a$,w$())
if arraysize(w$(),1)< 7 then
    print program$+" not found"
    exit
endif
print w$(7)

This can be used in a shell script:

Code:
#!sh
pid Terminal>Terminal.pid
pid=`cat Terminal.pid`
kill $pid

Fat Elk Sortware
Visit this user's website Find all posts by this user
Quote this message in a reply
Post Reply 


Forum Jump:


User(s) browsing this thread: 1 Guest(s)

Free Web Hosting