SHARE
TWEET

Untitled

a guest Feb 21st, 2019 59 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #!/bin/bash -ex
  2.  
  3. echo "stop running resque processes"
  4.  
  5. pidfile_sched="tmp/pids/resque_scheduler.pid"
  6. if [ -e $pidfile_sched ] ; then
  7.    scheduler_pid=$(cat $pidfile_sched)
  8.    echo "scheduler_pid: $scheduler_pid"
  9.     if [ -z $scheduler_pid ] ; then
  10.         echo "No PID found for resque scheduler"
  11.     else
  12.         kill -s QUIT $scheduler_pid > /dev/null 2>&1
  13.         rm $pidfile_sched
  14.         echo "resque scheduler with pid:$scheduler_pid stopped"
  15.     fi;
  16. else
  17.     echo "Resque scheduler pid file not found."
  18. fi;
  19.  
  20.  
  21.  
  22. if [ -e 'tmp/pids/resque_work_1.pid' ]; then
  23.     for element in $(ls -d tmp/pids/resque_work*.pid)
  24.     do
  25.         echo "element: $element"
  26.         pid=$(cat $element)
  27.         echo "pid $pid"
  28.  
  29.         if [ -z $pid ] ; then
  30.             echo "Resque process PID not found."
  31.         else
  32.             kill -s QUIT $pid
  33.             rm -f $element > /dev/null 2>&1
  34.             echo "Resque worker with pid:${pid} stopped"
  35.         fi;
  36.     done
  37. fi;
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top