forked from milos85vasic/Server-Factory-Utils
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathproxy_update.sh
executable file
·63 lines (44 loc) · 1.43 KB
/
proxy_update.sh
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
#!/bin/sh
here=$(dirname "$0")
working_directory="$1"
while true; do
config_file_name="proxy.cfg"
proxy_update_execute_script_name="proxy_update_execute.sh"
load_configuration_script_name="proxy_load_configuration.sh"
config_file="$working_directory/$config_file_name"
proxy_update_execute="$here/$proxy_update_execute_script_name"
load_configuration_script="$here/$load_configuration_script_name"
if ! test -e "$load_configuration_script"; then
echo "ERROR: $load_configuration_script does not exist"
exit 1
fi
# shellcheck disable=SC1090
. "$load_configuration_script"
load_configuration "$config_file"
# shellcheck disable=SC2154,SC2129
sleep "$frequency"
# shellcheck disable=SC2154
if test -e "$log"; then
if rm -f "$log"; then
echo "$log: has been removed"
else
echo "WARNING: $log has not been removed"
fi
fi
echo "Working directory: $working_directory" >>"$log"
if test -e "$proxy_update_execute"; then
# shellcheck disable=SC2154
export PROXY_HOST_FALLBACK="$hostFallback"
# shellcheck disable=SC2154,SC2129
if sh "$proxy_update_execute" "$working_directory" "$host" \
"$port" "$account" "$password" \
"$certificate_endpoint" "$log" "$behavior_get_ip"; then
echo "Proxy has been updated"
else
echo "ERROR: Could not update proxy"
fi
else
echo "ERROR: $proxy_update_execute does not exist" >>"$log"
exit 1
fi
done