What's new

Triggering bash script

  • SNBForums Code of Conduct

    SNBForums is a community for everyone, no matter what their level of experience.

    Please be tolerant and patient of others, especially newcomers. We are all here to share and learn!

    The rules are simple: Be patient, be nice, be helpful or be gone!

RobW

New Around Here
Hi,

I want to trigger a bash script on the router, without logging in. To turn the vpn_client on or off (not event based, but just when I want).
What are the options, without running cru jobs very often ?

Is this possible ?
 
Hi,

I have no ios device.
Is it possible to create a new destination like http://router_ip/stop_vpn_client1 and when I go there it starts the script. And without logging in.

Just trying to figure out my options.
No, not without installing a separate web server on the router.
 
I found a way.

First: installed inotifywait
Then : mounted USB drive in Router

I have an USB in the router, so I used a map for triggering.
I pinned (in windows on the taskbar) two batch files, to copy a file to the USB.

And after boot, the following script is automatically starting.

#!/bin/sh
inotifywait -m /mnt/Router/Trigger -e create -e moved_to |
while read path action file; do
#echo "The file '$file' appeared in directory '$path' via '$action'"

case $file in
VPN_ON)
rm $path$file
service start_vpnclient1
;;
VPN_OFF)
rm $path$file
service stop_vpnclient1
;;
*)
rm $path$file
;;
esac
done


Just finnished this idea. Hope it's stable :)
 

Latest threads

Support SNBForums w/ Amazon

If you'd like to support SNBForums, just use this link and buy anything on Amazon. Thanks!

Sign Up For SNBForums Daily Digest

Get an update of what's new every day delivered to your mailbox. Sign up here!
Top