Less known Solaris features: pwait
This is a nifty small tool that i’m using quite often in scripts that stop something and do some tasks afterwards and i don’t want to hassle around with the contract file system. It’s not a cool feature, but it’s useful and relatively less known. An example: As i wrote long ago, you should never use
kill -9 because often the normal kill is intercepted by the application and it starts to do some clean up tasks first before really stopping the process. So just because
kill has returned, it doesn’t imply that the process is away. How do you wait for process to disappear?
pwait you have a small tool for this task. Let’s assume you have tool running in the background
When you start
pwait with the PID as the parameter, it just waits and doesn’t return to the shell.
Now we kill the process
As soon as the process is away, the
pwait will return to shell.