Added the possibility to intercept several signal and trigger a proper stop of the code, as if the file prefix.EXIT was found.

Currently intercepted signals are SIGINT (caused by CTRL-C), SIGTERM (by default sent by PBS one minute before wall time expires), SIGUSR1, SIGUSR2

In order to compile this code add -D__TERMINATE_GRACEFULLY to MANUAL_DFLAGS in make.sys

This code partially conflicts with __TRAP_SIGUSR1, although they can both be compiled ony the last signal handler set will work. However they do the same thing, so __TRAP_SIGUSR1 could eventually be removed as it is less general. 

You can change the delay between the alert and the end of allocated wall time depending on the queue system. Here are some examples:

* with PBS:
  send the signal 120 seconds before the end:
  #PBS -l signal=@120

  send signal SIGUSR1 10 minutes before the end:
  #PBS -l signal=SIGUSR1@600

  you cand also send a signal manually with qsig, or send a signal and then stop:
   qdel -W 120 jobid
  will send SIGTERM, wait 2 minutes than force stop.

* with LodLeveler:
  According to documentation, a SIGUSR1 or a SIGTERM is sent, depending if the job will be restarted or not; SIGKILL follows after 2 minutes. There is no mention if this delay can be changed.



git-svn-id: http://qeforge.qe-forge.org/svn/q-e/trunk/espresso@11024 c92efa57-630b-4861-b058-cf58834340f0
Small change on previous commit: apparently (i.e. according to documentation) LoadLeveler send a SIGXCPU after soft_wall is reached and SIGKILL when har_wall is reached. I've added trapping of SIGXCPU.

Wall clock limit is specified as:
  wall_clock_limit = 5:00,4:30
which would give pw 30 minutes to shut down





git-svn-id: http://qeforge.qe-forge.org/svn/q-e/trunk/espresso@11025 c92efa57-630b-4861-b058-cf58834340f0
Restart features documented



git-svn-id: http://qeforge.qe-forge.org/svn/q-e/trunk/espresso@11026 c92efa57-630b-4861-b058-cf58834340f0
Small fix



git-svn-id: http://qeforge.qe-forge.org/svn/q-e/trunk/espresso@11027 c92efa57-630b-4861-b058-cf58834340f0