Created
August 29, 2014 19:05
-
-
Save egold/b2259dcf6a69852f1b3f to your computer and use it in GitHub Desktop.
Script to kill beanstalkd jobs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ubuntu@ip-10-123-151-236:~$ cat beanstalk-purge | |
#!/usr/bin/expect -f | |
# Filename: beanstalk-purge | |
set timeout 1 | |
spawn telnet [lindex $argv 0] [lindex $argv 1] | |
sleep 1 | |
send "use [lindex $argv 2]\n" | |
expect "USING" | |
for {set i 1} {$i < [lindex $argv 3]} { incr i 1 } { | |
send_user "Proccessing $i\n" | |
expect -re {.*} {} | |
send "peek-ready\n" | |
expect -re {FOUND (\d*) \d*} | |
send "delete $expect_out(1,string)\n" | |
expect "DELETED" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment