summaryrefslogtreecommitdiffhomepage
path: root/applications/luci-app-softether/root/usr/libexec/vpncmd-call
diff options
context:
space:
mode:
authorBERENYI Balazs <balazs@wee.hu>2020-12-16 17:22:37 +0000
committerBERENYI Balazs <balazs@wee.hu>2021-01-11 20:03:34 +0000
commitec5ce985fee50d4bcb02e70ae95be68cdfafc49e (patch)
treea116f6d8177de0116da3c7d74b44a6ba81f31c9f /applications/luci-app-softether/root/usr/libexec/vpncmd-call
parenta650949e2282c4b6583f5416b83ae6a3c6c3fb63 (diff)
luci-app-softether: add basic softether status page
Signed-off-by: BERENYI Balazs <balazs@wee.hu>
Diffstat (limited to 'applications/luci-app-softether/root/usr/libexec/vpncmd-call')
-rwxr-xr-xapplications/luci-app-softether/root/usr/libexec/vpncmd-call31
1 files changed, 31 insertions, 0 deletions
diff --git a/applications/luci-app-softether/root/usr/libexec/vpncmd-call b/applications/luci-app-softether/root/usr/libexec/vpncmd-call
new file mode 100755
index 0000000000..3d671dce4c
--- /dev/null
+++ b/applications/luci-app-softether/root/usr/libexec/vpncmd-call
@@ -0,0 +1,31 @@
+#!/bin/sh
+
+action=$1
+shift
+
+case "$action" in
+ nic-list)
+ /usr/bin/vpncmd localhost /client /csv /cmd:niclist | tail -n +4 2> /dev/null
+ ;;
+ nic-create)
+ /usr/bin/vpncmd localhost /client /cmd:niccreate $1 > /dev/null && echo "OK" || echo "NOK"
+ ;;
+ nic-delete)
+ /usr/bin/vpncmd localhost /client /csv /cmd:nicdelete $1 > /dev/null && echo "OK" || echo "NOK"
+ ;;
+ account-list)
+ /usr/bin/vpncmd localhost /client /csv /cmd:accountlist | tail -n +4 2> /dev/null
+ ;;
+ account-status-get)
+ /usr/bin/vpncmd localhost /client /csv /cmd:accountstatusget $1 | tail -n +4 2> /dev/null
+ ;;
+ *)
+ echo "Usage:" >&2
+ echo " $0 {nic-list}" >&2
+ echo " $0 {nic-create} {name}" >&2
+ echo " $0 {nic-delete} {name}" >&2
+ echo " $0 {account-list}" >&2
+ echo " $0 {account-status-get {accountname}" >&2
+ exit 1
+ ;;
+esac