Forums
New posts
Articles
Product Reviews
Policies
FAQ
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Menu
Log in
Register
Install the app
Install
Forums
macOS & iOS Developer Playground
macOS - Development and Darwin
Simple script that starts a service at router level
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
<blockquote data-quote="Raz0rEdge" data-source="post: 1795512" data-attributes="member: 110816"><p>Your best bet is to use <a href="https://www.tcl.tk/man/expect5.31/expect.1.html" target="_blank">Expect</a> to accomplish this. It is a good scripting language to send commands, wait for things and send additional commands and wait, and so on.</p><p></p><p>So you first send the "ssh" command and then expect "password:" or some other recognizable string and then send the password and expect "$" or whatever the prompt looks like, and then you'd send the "openvpn" command and then maybe send a "ps -e | grep openvpn" command and expect to see "openvpn" in the list confirming that it started and then you'd send "exit" to kill the SSH session and close the script.</p><p></p><p>If you are familiar with coding, translate my "pseudo" code to the actual code, if not, I'll take a whack at it when I have a moment and send it across.</p></blockquote><p></p>
[QUOTE="Raz0rEdge, post: 1795512, member: 110816"] Your best bet is to use [URL="https://www.tcl.tk/man/expect5.31/expect.1.html"]Expect[/URL] to accomplish this. It is a good scripting language to send commands, wait for things and send additional commands and wait, and so on. So you first send the "ssh" command and then expect "password:" or some other recognizable string and then send the password and expect "$" or whatever the prompt looks like, and then you'd send the "openvpn" command and then maybe send a "ps -e | grep openvpn" command and expect to see "openvpn" in the list confirming that it started and then you'd send "exit" to kill the SSH session and close the script. If you are familiar with coding, translate my "pseudo" code to the actual code, if not, I'll take a whack at it when I have a moment and send it across. [/QUOTE]
Verification
Post reply
Forums
macOS & iOS Developer Playground
macOS - Development and Darwin
Simple script that starts a service at router level
Top