General Question

saservp's avatar

Can you translate a line of bash into plain english for me?

Asked by saservp (291points) August 12th, 2011

I vaguely understand what this is doing, but can someone translate it into layman’s english:

while :; do sleep 1; ps | grep openvpn && killall openvpn && break || continue; done

echo “username
password” > /tmp/openvpncl/auth.conf

openvpn

In particular, is it checking if openvpn dies and then restarts it? And how often does it check? every “1” minute/second?

Observing members: 0 Composing members: 0

2 Answers

laureth's avatar

From Mr. Laureth, who once made a living on the UNIX command line:

“While I used csh instead of bash, when I did shell scripting, I believe it does this:

1. Pause for 1 second

2. Check if openvpn is running; if it is, kill it.

3. If someone logs on, add the username and password to the file /tmp/openvpncl/auth.conf .

4. Start openvpn.

5. Loop back to the sleep.

Either I’m way off, or this is a way to collect usernames and passwords of third parties. It’s hard to come up with a legitimate reason to do this.”

saservp's avatar

Thanks. No not a way to collect passwords. It starts up openvpn and runs on dd-wrt (http://www.dd-wrt.com/). You have to write your user/pass to a temporary file every time it boots because it doesn’t save it permanently.

I just wanted to know exactly what these few lines did. Thanks!

Answer this question

Login

or

Join

to answer.

This question is in the General Section. Responses must be helpful and on-topic.

Your answer will be saved while you login or join.

Have a question? Ask Fluther!

What do you know more about?
or
Knowledge Networking @ Fluther