diff options
author | justanothercatgirl <sotov2070@gmail.com> | 2024-04-11 13:00:50 +0300 |
---|---|---|
committer | justanothercatgirl <sotov2070@gmail.com> | 2024-04-11 13:00:50 +0300 |
commit | 732e507db3c1664d6d64889b3186df766c9217d4 (patch) | |
tree | 2154441af35257c85a0c1aa33a4a6b9e8c0063d8 /.root/usr/local/bin/proxyctl | |
parent | dbb48f0acaacede21cfccfb8f30a206236520068 (diff) |
added group-media script
Diffstat (limited to '.root/usr/local/bin/proxyctl')
-rwxr-xr-x | .root/usr/local/bin/proxyctl | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/.root/usr/local/bin/proxyctl b/.root/usr/local/bin/proxyctl index d46ec4f..839ef66 100755 --- a/.root/usr/local/bin/proxyctl +++ b/.root/usr/local/bin/proxyctl @@ -1,24 +1,24 @@ -#!/bin/env /bin/bash +#!/bin/bash . /etc/profile.d/proxy.sh function proxy_update_config() { if [ $UID -ne 0 ]; then echo "This command requires root privileges. Aborting..." - exit 1 + return 1 fi SRCD=/etc/sing-box ${SRCD}/libconfig_to_json.py ${SRCD}/libconfig ${SRCD}/config.json if [ $? -ne 0 ]; then echo "Failed to write config. Aborting..." - exit 1 + return 1 fi systemctl restart sing-box status=$(systemctl status sing-box) if [ $? -ne 0 ]; then echo "Failed to start sing-box. Manual intervention needed." - exit 1 + return 1 else echo "Success" fi @@ -41,7 +41,7 @@ function __help() { if [ $# -lt 1 ]; then echo "insufficient arguments. needed: . provided: $#" __help - exit 1 + return 1 fi if [ $1 = update ] || [ $1 = reload ]; then proxy_update_config @@ -57,9 +57,11 @@ elif [ $1 = start ] || [ $1 = stop ] || [ $1 = enable ] || [ $1 = disable ]; the echo "Failed to $1 sing-box" echo "otput of 'systemctl status sing-box':" echo ${STATUS_TEXT} - exit ${STATUS} + return ${STATUS} fi +elif [ $1 = "--help" ] || [ $1 = help ] || [ $1 = "-h" ]; then + __help else echo "Unknown command." - exit 1 + return 1 fi |