Advertisement
Guest User

beanstalk-purge

a guest
Oct 21st, 2019
126
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.53 KB | None | 0 0
  1.  
  2. The Code
  3.  
  4. #!/usr/bin/expect -f
  5. # Filename: beanstalk-purge
  6. set timeout 1
  7.  
  8. spawn telnet [lindex $argv 0] [lindex $argv 1]
  9. sleep 1
  10. send "use [lindex $argv 2]\n"
  11. expect "USING"
  12.  
  13. for {set i 1} {$i < [lindex $argv 3]} { incr i 1 } {
  14.     send_user "Proccessing $i\n"
  15.     expect -re {.*} {}
  16.     send "peek-ready\n"
  17.     expect -re {FOUND (\d*) \d*}
  18.     send "delete $expect_out(1,string)\n"
  19.     expect "DELETED"
  20. }
  21. Usage
  22.  
  23. beanstalk-purge <host> <port> <tube> <count>
  24. Example
  25.  
  26. beanstalk-purge 127.0.0.1 11300 snitch.site 35000
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement