Created
January 23, 2020 05:35
-
-
Save bikalbasnet/296bd4092ba93f20e2eccccebf09762a to your computer and use it in GitHub Desktop.
Code to delete data from tube (uses loop)
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
#!/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" | |
} | |
# USAGE: beanstalk-purge [ip address] 11300 [tube_name] [number of jobs to delete] | |
# Example: beanstalk-purge 127.0.0.1 11300 default 3 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment