1 files changed, 16 insertions, 16 deletions
|
diff --git a/socat.sh b/socat.sh index c3e0e60..e3f1220 100755 --- a/ socat.sh+++ b/ socat.sh |
@@ -14,14 +14,14 @@ service_launch_command() |
14 | local dest port local_port |
14 | local dest port local_port |
15 | dest=${1:-$default_dest} |
15 | dest=${1:-$default_dest} |
16 | case "$dest" in |
16 | case "$dest" in |
17 | '') return 1 ;; |
17 | '') return 1 ;; |
18 | *:*) |
18 | *:*) |
19 | port=${dest#*:} |
19 | port=${dest#*:} |
20 | dest=${dest%%:*} |
20 | dest=${dest%%:*} |
21 | ;; |
21 | ;; |
22 | *) |
22 | *) |
23 | port=${2:-$default_port} |
23 | port=${2:-$default_port} |
24 | ;; |
24 | ;; |
25 | esac |
25 | esac |
26 | local_port=${3:-$port} |
26 | local_port=${3:-$port} |
27 | |
27 | |
@@ -51,7 +51,7 @@ main() |
51 | case "$1" in |
51 | case "$1" in |
52 | install) |
52 | install) |
53 | shift |
53 | shift |
54 | COMMAND=$(service_launch_command "$@") |
54 | COMMAND=$(service_launch_command "$@") |
55 | if systemctl is-active "$UNIT" >/dev/null |
55 | if systemctl is-active "$UNIT" >/dev/null |
56 | then |
56 | then |
57 | systemctl stop "$UNIT" |
57 | systemctl stop "$UNIT" |
@@ -66,16 +66,16 @@ main() |
66 | "$0" watchdog "$COMMAND" verify_service_availability |
66 | "$0" watchdog "$COMMAND" verify_service_availability |
67 | ;; |
67 | ;; |
68 | watchdog) |
68 | watchdog) |
69 | shift |
69 | shift |
70 | watchdog $$ "$2" & |
70 | watchdog $$ "$2" & |
71 | exec $1 |
71 | exec $1 |
72 | ;; |
72 | ;; |
73 | status) |
73 | status) |
74 | systemctl status "$UNIT" |
74 | systemctl status "$UNIT" |
75 | ;; |
75 | ;; |
76 | monitor) |
76 | monitor) |
77 | journalctl -u "$UNIT" -f |
77 | journalctl -u "$UNIT" -f |
78 | ;; |
78 | ;; |
79 | *) |
79 | *) |
80 | echo "Usage: $0 install [destination [destination port [local port]]]" >&2 |
80 | echo "Usage: $0 install [destination [destination port [local port]]]" >&2 |
81 | echo " $0 status" >&2 |
81 | echo " $0 status" >&2 |
|