Linux signal

I was writing a shell scripts to manage my process. basically I have some jobs need to be run for long time at least 2 weeks, but the problem is that the system manager will kill all my processes during the night because it takes too much cpu resource and it increases the temperature.

So, I wanted to write a small scripts which can make all my processes stop during the night and resume next day.

There is SIGNALs

`HUP’ : 1. Hangup.

`INT’ : 2. Terminal interrupt.

`QUIT’ : 3. Terminal quit.

`ABRT’ : 6. Process abort.

`KILL’ : 9. Kill (cannot be caught or ignored).

`ALRM’ : 14. Alarm Clock.

`TERM’ : 15. Termination.

`BUS’ : Access to an undefined portion of a memory object.

`CHLD’ : Child process terminated, stopped, or continued.

`CONT’ : Continue executing, if stopped.

`FPE’ : Erroneous arithmetic operation.

`ILL’ : Illegal Instruction.

`PIPE’ : Write on a pipe with no one to read it.

`SEGV’ : Invalid memory reference.

`STOP’ : Stop executing (cannot be caught or ignored).

`TSTP’ : Terminal stop.

`TTIN’ : Background process attempting read.

`TTOU’ : Background process attempting write.

`URG’ : High bandwidth data is available at a socket.

Especially TSTP and CONT was useful for my job.
for example,

for line in $(cat $hosts)
do
pid=$(rsh $line ps aux|grep “rosetta.gcc”|awk ‘{print $2}’);
if [ $pid ] ; then
rsh $line kill -TSTP $pid
fi
done

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: