Printable Version of Topic

Click here to view this topic in its original format

914World.com _ 914World Garage _ OT: korn/unix question, for gurus

Posted by: tat2dphreak Feb 23 2007, 02:00 PM

I am writing a ksh script to remove the semaphores not cleaned up by a unix program... problem is there's a lot of semphores on the box owned by the same users... so I need to seek out and find ONLY the 1 semaphore associated with the process... the process also creates a physical file to link to the semaphore in the tmp dir, if that helps.

is there a ksh version of C's semget functions?



maybe something extended with the ipcs command?


Posted by: fiid Feb 23 2007, 05:30 PM

lsof can tell you what stuff a running process has... you might be able to use that - although it's not available on all unixes (although it can be installed).

If you use perl instead of ksh, you can probably use the semget functions. I generally recommend using a language like perl anyways since it's much easier to tell if you've made a coding mistake than it is in a shell script.

ipcs -p seems to list out semaphores and their owning processes, btw. "man ipcs" will tell you more on what facilities are available.




Powered by Invision Power Board (http://www.invisionboard.com)
© Invision Power Services (http://www.invisionpower.com)