/cistromescripts/kill_processes_over_1day.sh

https://bitbucket.org/cistrome/cistrome-harvard/ · Shell · 13 lines · 5 code · 4 blank · 4 comment · 1 complexity · 9a1a9c619d746b4f162fd316fd035f45 MD5 · raw file

  1. #!/bin/bash
  2. # the account the cistrome server runs on in *nix system.
  3. CISTROMEAP_ACCOUNT=cistromeap
  4. # this command return the processed run by cistromeap, sorted by
  5. # elapsed time after the job is started.
  6. ps --sort etime -u ${CISTROMEAP_ACCOUNT} -o etime=,pid=,args | grep -v paster.py | perl -ne 'print if /\-\d\d\:\d\d\:\d\d/' | perl -ane 'print $F[1],"\n"' > ps_jobs1day.txt
  7. while read i;do kill -9 $i;done < ps_jobs1day.txt
  8. echo "Killed by ",`date`
  9. cat /data/CistromeAP/galaxy-dist/ps_jobs1day.txt