Guest User

Untitled

a guest
Oct 18th, 2018
129
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.52 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. queue="resque:queue:notifications"
  4.  
  5. # Replace with location pertinent to your setup.
  6. cd ~/src/digistore_new/administrators
  7.  
  8. had=`redis-cli llen $queue |sed 's/\([0-9]\+\)/$1/'`
  9.  
  10. # TODO: There must be a way to do this in one operation.
  11. redis-cli ltrim $queue 0 0 >/dev/null
  12. redis-cli lpop $queue >/dev/null
  13.  
  14. # Check for errors.
  15. now=`redis-cli llen $queue |sed 's/\([0-9]\+\)/$1/'`
  16. if [ "$now" != '0' ]
  17. then
  18. 2>&1 echo "Unable to empty queue $queue: ($now elements)"
  19. 2>&1 redis-cli lrange $queue 0 25
  20. exit 1
  21. fi
Add Comment
Please, Sign In to add comment