[Solved] OpenVPN Script: WARNING: Failed running command

How to customize and extend your OpenVPN installation.

Moderators: TinCanTech, TinCanTech, TinCanTech, TinCanTech, TinCanTech, TinCanTech

Post Reply
GorkyV
OpenVpn Newbie
Posts: 3
Joined: Thu Aug 25, 2016 7:35 pm

[Solved] OpenVPN Script: WARNING: Failed running command

Post by GorkyV » Thu Aug 25, 2016 7:38 pm

Hello all!

I searched quite a bit but couldn't figure out how to fix the following issue.

At the moment I am using OpenVPN on my RT-N66U router. I am trying to add an script that sends an email to me when someone connects.

The script can be found here:
http://www.snbforums.com/threads/tutori ... ons.20828/

I have uploaded this script to the /jffs/scripts partition of the router. I have also set these scripts to permissions 0777.

In the custom configuration I have added:

script-security 2
client-connect /jffs/scripts/up.sh
client-disconnect /jffs/scripts/down.sh

However it keeps giving me this error:
WARNING: Failed running command (--client-connect): could not execute external program

Could anyone help me with the error.

Thanks in advance!

GorkyV
OpenVpn Newbie
Posts: 3
Joined: Thu Aug 25, 2016 7:35 pm

Re: OpenVPN Script

Post by GorkyV » Thu Aug 25, 2016 8:34 pm

Using this made the script execute:

script-security 2
--client-connect "/bin/sh /jffs/scripts/up.sh"
--client-disconnect "/bin/sh /jffs/scripts/down.sh"

However it gave the following error: WARNING: Failed running command (--client-connect): external program exited with error status: 1

Something seems to be broken in the script. Can we verbose that error some more?

GorkyV
OpenVpn Newbie
Posts: 3
Joined: Thu Aug 25, 2016 7:35 pm

Re: OpenVPN Script

Post by GorkyV » Fri Aug 26, 2016 9:04 pm

I managed to fix it. The script was fixed using this command:
dos2unix /jffs/scripts/up.sh
Given to me by a person at this forum:
http://www.snbforums.com/threads/tutori ... ons.20828/

TinCanTech
OpenVPN Protagonist
Posts: 11137
Joined: Fri Jun 03, 2016 1:17 pm

Re: OpenVPN Script

Post by TinCanTech » Fri Aug 26, 2016 9:06 pm

dos2unix .. did not see that coming :geek:

Thanks for letting us know your solution (sorry we could not help) 8-)

afk
OpenVpn Newbie
Posts: 2
Joined: Thu Oct 12, 2017 9:10 am

Re: [Solved] OpenVPN Script: WARNING: Failed running command

Post by afk » Wed Nov 13, 2019 12:10 pm

Hello,

Even if I've used dos2unix 'script.sh' still did not have any luck.

So I've added exit 0 at the end of each script. Now they seem to work.

server : openvpn-2.4.0-2.mga5
client: openvpn-2.4.7-1.mga7

TinCanTech
OpenVPN Protagonist
Posts: 11137
Joined: Fri Jun 03, 2016 1:17 pm

Re: [Solved] OpenVPN Script: WARNING: Failed running command

Post by TinCanTech » Wed Nov 13, 2019 3:20 pm

Explicitly exiting with 0 is probably over riding the error your script has detected and is not recommended.
Better to understand why the script detected the error in the first place ..

Post Reply