summaryrefslogtreecommitdiffhomepage
path: root/applications/luci-app-softether/root/usr/libexec/vpncmd-call
blob: 3d671dce4c819107cdcf9230775265a4224291cc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
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