I am running 3.0.0.4.270.26b.
I have been able to use scripts placed in /jffs/scripts just fine, but I cannot get the 'openvpn-event' script to work. It appears that it is not called.
Can someone verify the openvpn-event script is working for them?
Thanks,
- Henrik
That feature was added in 3.0.0.4.354.28.
That feature was added in 3.0.0.4.354.28.
#!/bin/sh
logger "openvpn-event event called"
#call the script to load selective routing
sh loadSelectiveRouting
I have version 3.0.0.4.374.38_1 on RT-AC68U and openvpn-event is called if I turn on a client connection to a VPN server, but it is not called if I reboot.
The VPN connection is set to start with WAN, but the script it is not called.
Any ideas?
EDIT: noup, the scripts doesn't work at all. I have the script /jffs/scripts/openvpn-event as chmod 777 and in it I have the following code:
Code:#!/bin/sh logger "openvpn-event event called" #call the script to load selective routing sh loadSelectiveRouting
The result? The line is not written in the log and my custom script is not called.
In the script loadSelectiveRouting I have the line "touch /tmp/000wanstarted", but the file is not created
Is this user script still available with my version?
#!/bin/sh
touch /tmp/000_YAY
I am trying to automatically run a script when the router connects as an OpenVPN Client to my VPN provider. The script (which opens a port in the firewall among other things) works fine when I run it manually.
Using this code in openvpn-event as a simple test....
Code:#!/bin/sh touch /tmp/000_YAY
...the file fails to be written. It makes no difference if the OpenVPN Client connection Starts on WAN, or if I connect manually, the result is the same. I have set the read and execute permissions correctly, I've tried using both the Client 1 and Client 2 settings... I just don't understand it.![]()
mount
ls /jffs/scripts -l
nvram get buildno
script-security 2
route-up /jffs/scripts/xxx.sh
XXX@RT-N66U:/tmp# mount
rootfs on / type rootfs (rw)
/dev/root on / type squashfs (ro)
proc on /proc type proc (rw)
tmpfs on /tmp type tmpfs (rw)
devfs on /dev type tmpfs (rw,noatime)
sysfs on /sys type sysfs (rw)
devpts on /dev/pts type devpts (rw)
/dev/mtdblock4 on /jffs type jffs2 (rw,noatime)
usbfs on /proc/bus/usb type usbfs (rw)
/dev/sdb1 on /tmp/mnt/sdb1 type ext2 (rw,nodev,noatime)
/dev/sda1 on /tmp/mnt/My_Passport type ufsd (rw,nodev,noatime,nls=utf8,fmask=0,dmask=0,force)
XXX@RT-N66U:/tmp# ls /jffs/scripts -1
firewall-start
openvpn-event
pia-port
post-mount
services-start
services-stop
XXX@RT-N66U:/tmp# nvram get buildno
374.34
Mar 4 10:37:01 openvpn[1521]: WARNING: Failed running command (--route-up): could not execute external program
Here are the output results:
Code:XXX@RT-N66U:/tmp# mount rootfs on / type rootfs (rw) /dev/root on / type squashfs (ro) proc on /proc type proc (rw) tmpfs on /tmp type tmpfs (rw) devfs on /dev type tmpfs (rw,noatime) sysfs on /sys type sysfs (rw) devpts on /dev/pts type devpts (rw) /dev/mtdblock4 on /jffs type jffs2 (rw,noatime) usbfs on /proc/bus/usb type usbfs (rw) /dev/sdb1 on /tmp/mnt/sdb1 type ext2 (rw,nodev,noatime) /dev/sda1 on /tmp/mnt/My_Passport type ufsd (rw,nodev,noatime,nls=utf8,fmask=0,dmask=0,force) XXX@RT-N66U:/tmp# ls /jffs/scripts -1 firewall-start openvpn-event pia-port post-mount services-start services-stop XXX@RT-N66U:/tmp# nvram get buildno 374.34
See anything weird there?
I created /jffs/scripts/debug.sh and added the lines of code you suggested to the Custom Configuration and then restarted the Client connection, but I'm not sure where I should be looking for the debugging file. The System Log shows:
Code:Mar 4 10:37:01 openvpn[1521]: WARNING: Failed running command (--route-up): could not execute external program
Thanks for the input.
ls /jffs/scripts -l
XXX@RT-N66U:/jffs/scripts# ls /jffs/scripts -l
-rwxrwxrwx 1 XXX root 0 Mar 4 10:22 debug.sh
-rwxrwxrwx 1 XXX root 130 Mar 3 14:49 firewall-start
-rwxrwxrwx 1 XXX root 30 Mar 4 10:38 openvpn-event
-rwxrwxrwx 1 XXX root 656 Mar 3 15:44 pia-port
-rwxrwxrwx 1 XXX root 76 Feb 27 11:31 post-mount
-rwxrwxrwx 1 XXX root 53 Feb 27 11:31 services-start
-rwxrwxrwx 1 XXX root 43 Feb 27 11:31 services-stop
Yes, it's incredibly easy to make mistakes! This is my first experience with Linux, and I am not a developer. I appreciate your patience.
Here's the proper output:
Code:XXX@RT-N66U:/jffs/scripts# ls /jffs/scripts -l -rwxrwxrwx 1 XXX root 0 Mar 4 10:22 debug.sh -rwxrwxrwx 1 XXX root 130 Mar 3 14:49 firewall-start -rwxrwxrwx 1 XXX root 30 Mar 4 10:38 openvpn-event -rwxrwxrwx 1 XXX root 656 Mar 3 15:44 pia-port -rwxrwxrwx 1 XXX root 76 Feb 27 11:31 post-mount -rwxrwxrwx 1 XXX root 53 Feb 27 11:31 services-start -rwxrwxrwx 1 XXX root 43 Feb 27 11:31 services-stop
/jffs/scripts/debug.sh does exist, and is chmod 777, but I still get the "could not execute external program" in the system log.
Sorry I did not understand what you meant by "debugging file." (I thought I was looking for an error log of some sort to be produced.) The file /tmp/000_YAY still doesn't get created.
I am doing all edits through Putty using Nano.
Ah. Forgive my absurd ignorance. NOW I understand what you wanted me to do.
The debugging file is now successfully created when I bounce the Client connection.
up /jffs/scripts/xxxx.sh
or
route-up /jffs/scripts/yyyyy.sh
Thanks for the help. That gets me part way there. Using "up," the script finishes, but not all the commands work. I think some are unsupported.
(The script uses curl to post my IP address and credentials to an API that returns the port number that has been assigned to me, which I then add to the IP tables. ifconfig gets my ip address all right, but the curl command fails.)
We use essential cookies to make this site work, and optional cookies to enhance your experience.