Expect – A tool for automating interactive applications
expect.sourceforge.net
expect.sourceforge.net
I once wrote a webserver in Expect. No, it's not a good language for writing a webserver.
It's Tcl, by the way, not TCL.
Then there was that weird period when all the other language's gui toolkits were based on Tk.
Also: no other scripting language with the possible exception of JS has evented I/O so fundamentally baked into the core of the language.
When you say it was one of the best systems for doing dynamic websites, would you use it on its own, or was it more popular to use OpenACS on top of it? (Which is what one of the codebases I still work on today does)
Edit: still trying to install autoexpect on Mac OS 10.9.2 and having no luck. Tried ActiveTcl at http://www.activestate.com/activetcl/downloads but it doesn't seem to have autoexpect. Tried brew install autoexpect, tried port install autoexpect, nothing. Sometimes unix reminds me of looking up hints in video game magazines upon finding oneself stuck, so if someone knows how to get autoexpect on Mac, please let us know because I'm throwing in the towel.
brew install expect secure_mysql_script=$(expect -c '
spawn sudo mysql_secure_installation
expect "Enter current password for root (enter for none):"
send "\r"
expect "Change the root password?"
send "n\r"
expect "Remove anonymous users?"
send "y\r"
expect "Disallow root login remotely?"
send "y\r"
expect "Remove test database and access to it?"
send "y\r"
expect "Reload privilege tables now?"
send "y\r"
expect eof
')
echo "$secure_mysql_script"http://ianmiell.github.io/shutit/
it really is 95% of tcl's expect functionality, much easier to debug and understand. I'm grateful it exists, and it's much under-used I think.
I have a somewhat similar tool but it doesn't do much besides check for password expiry and do password changes.
It uses pexpect but also multiprocessing and multiprocessing.Queue. I built most of it before we started using Ansible at work, but it is still useful in those places where Ansible is clumsy.
I was just sort of echoing your
annoyed by the obfuscation and indirection of ...
Ansible's prime raison d'être is not remote execution but configuration management.It's available via rubygems or github: https://github.com/avdi/greenletters
http://www.digitalprognosis.com/opensource/scripts/change_pa...
It might be useful to someone else.
http://expect.cvs.sourceforge.net/viewvc/expect/expect/Chang...
Also, you can apt-get install `expect`.
I'm wondering if it's something I should take the time to learn and use.
https://github.com/SchedMD/slurm/tree/master/testsuite/expec...
If you don't know expect (and you're a sysadmin), learn it.
>Expect is a tool for automating interactive applications such as telnet, ftp, passwd, fsck, rlogin, tip, etc. Expect really makes this stuff trivial.
How?
>Expect can make easy all sorts of tasks that are prohibitively difficult with anything else. You will find that Expect is an absolutely invaluable tool - using it, you will be able to automate tasks that you've never even thought of before - and you'll be able to do this automation quickly and easily.
HOW?
Ah, examples... >http://expect.sourceforge.net/#examples
It's just a giant README. This is frustrating.
This script runs the meteor deploy command as part of my CI loop every time new code gets pushed to github. The deploy command expects me to type in a bunch of information, and expect does that for me.
It's a fast hacking provisioning tool, I really like it for this purpose.
I used it a few years ago to create a test suite for some dedicated VoIP hardware (controlling the boxes over telnet). It worked great, but if I had had more time, that definitely would not have been my approach.