- Add vpn.bash libraries,

- Add rx3_vpn_adm tools.
This commit is contained in:
2025-07-11 18:39:59 +02:00
parent 84d00cfd8b
commit 15678efa10
8 changed files with 429 additions and 7 deletions

View File

@@ -141,7 +141,7 @@ address_refresh()
# Main
#--------------------------------------------------------------------------------------------------------------------------
network_tab_load
network_init
case "$1" in
start)
@@ -180,4 +180,6 @@ case "$1" in
;;
esac
network_deinit
exit $RETVAL

120
usr/local/sbin/rx3_vpn_adm Executable file
View File

@@ -0,0 +1,120 @@
#!/bin/bash
RETVAL=0
#DEBUG=""
#DEBUG="echo"
#DEBUG=":"
#LOG=":"
#LOG="echo"
# Includes
#-----------------------------------------------------------------------------------------------------------------------------------
. /usr/local/lib/vpn.bash
#--------------------------------------------------------------------------------------------------------------------------
# Start
#--------------------------------------------------------------------------------------------------------------------------
start()
{
echo "Starting..."
if [ -r /var/lock/subsys/rx3-vpn ]
then
echo "already started"
RETVAL=0
else
vpn_start
RETVAL=$?
[ "$RETVAL" = 0 ] && touch /var/lock/subsys/rx3-vpn
fi
echo
}
#--------------------------------------------------------------------------------------------------------------------------
# Stop
#--------------------------------------------------------------------------------------------------------------------------
stop()
{
echo "Stopping..."
if [ -r /var/lock/subsys/rx3-vpn ]
then
vpn_stop
RETVAL=$?
else
echo "already stopped"
RETVAL=0
fi
[ "$RETVAL" = 0 ] && rm -f /var/lock/subsys/rx3-vpn
echo
}
#--------------------------------------------------------------------------------------------------------------------------
# Status
#--------------------------------------------------------------------------------------------------------------------------
status()
{
vpn_status
}
#--------------------------------------------------------------------------------------------------------------------------
# Main
#--------------------------------------------------------------------------------------------------------------------------
vpn_init
case "$1" in
start)
start
;;
stop)
stop
;;
restart)
stop
sleep 1
start
;;
status)
status
;;
*)
echo "Usage: $0 {start|stop|restart|status}"
RETVAL=1
;;
esac
vpn_deinit
exit $RETVAL