diff options
author | Andrew Cady <d@jerkface.net> | 2023-04-27 08:45:50 -0400 |
---|---|---|
committer | Andrew Cady <d@jerkface.net> | 2023-04-27 08:45:50 -0400 |
commit | f9bbb5ec05a1e360bde9da0c3fdd99079636ec29 (patch) | |
tree | d1819ee23322b0e02686699c62028f60d823adfb /socat.sh | |
parent | 1d1fb1bcdd5ef4a1772d21de76296fba51acd9e8 (diff) |
Diffstat (limited to 'socat.sh')
-rwxr-xr-x | socat.sh | 32 |
1 files changed, 16 insertions, 16 deletions
@@ -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 |