Thursday, November 05, 2009

Unix Script To Suspend Resume a Process

Have you ever wanted to programmatically suspend and resume a Unix process. Possibly setting up to do this in a periodic fashion for N cycles. This can be done easily using Unix signals such as SIGSTOP, and SIGCONT. The SIGSTOP will cause a process to suspend but not stop, and the SIGCONT will cause the process to resume.

So the trick is to determine the PID for the process you want to suspend or resume, and then set up the parameters governing the amount of time you want the process to sleep and run. Additionally, you may want to control the termination of he underlying process based on a number of cycles, time, or some other criteria. Well I have found an excellent script to do just that:

A brief discussion can be found at Discussion.
Of Course, for the impatient a The Script.

No comments:

Post a Comment