I’m trying to automate a startup of a specific service with bash
When the service is started with init.d (/etc/init.d/openvpn.custom) it is promting for username and then password – and then it connects
The auth-user-pass from-file is not possible with the installed version, and it cannot be upgraded because of dependencies
So i’m trying to write a simple bash scripts that executes the init.d script, sleeps for a bit, inputs the username, returns, sleeping a bit, inputting the password – you’ll get the flow.
like http://pastebin.com/qWHX7Di5
I’ve experimented with echo, but it doesent seem to work
This is for a rather legacy firewall i’m asked to keep connected.
Is this even possible?
I would use
expectinstead ofbash. You can still call it from withinbashif you need to do other tasks as well.In
expect, the script would be something like the following (untested):You’d want to change the
expect "Username:"&expect "Password:"lines to match the actual login prompts that are output by yourinit.dscript.See the
expectman page for further details.