Skip to content

Commit 3d942cf

Browse files
committed
fix caddy run
1 parent 45b0991 commit 3d942cf

File tree

3 files changed

+20
-14
lines changed

3 files changed

+20
-14
lines changed

sing-box.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/bin/bash
22

33
args=$@
4-
is_sh_ver=v1.01
4+
is_sh_ver=v1.02
55

66
. /etc/sing-box/sh/src/init.sh

src/init.sh

+17-11
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,17 @@ warn() {
4747
echo -e "\n$is_warn $@\n"
4848
}
4949

50+
# load bash script.
51+
load() {
52+
. $is_sh_dir/src/$1
53+
}
54+
55+
# wget add --no-check-certificate
56+
_wget() {
57+
# [[ $proxy ]] && export https_proxy=$proxy
58+
wget --no-check-certificate "$@"
59+
}
60+
5061
# yum or apt-get
5162
cmd=$(type -P apt-get || type -P yum)
5263

@@ -106,6 +117,12 @@ else
106117
fi
107118
if [[ -f $is_caddy_bin && -d $is_caddy_dir && $is_caddy_service ]]; then
108119
is_caddy=1
120+
# fix caddy run; ver >= 2.8.2
121+
[[ ! $(grep '\-\-adapter caddyfile' /lib/systemd/system/caddy.service) ]] && {
122+
load systemd.sh
123+
install_service caddy
124+
systemctl restart caddy &
125+
}
109126
is_caddy_ver=$($is_caddy_bin version | head -n1 | cut -d " " -f1)
110127
is_tmp_http_port=$(egrep '^ {2,}http_port|^http_port' $is_caddyfile | egrep -o [0-9]+)
111128
is_tmp_https_port=$(egrep '^ {2,}https_port|^https_port' $is_caddyfile | egrep -o [0-9]+)
@@ -119,17 +136,6 @@ if [[ -f $is_caddy_bin && -d $is_caddy_dir && $is_caddy_service ]]; then
119136
fi
120137
fi
121138

122-
# load bash script.
123-
load() {
124-
. $is_sh_dir/src/$1
125-
}
126-
127-
# wget add --no-check-certificate
128-
_wget() {
129-
# [[ $proxy ]] && export https_proxy=$proxy
130-
wget --no-check-certificate "$@"
131-
}
132-
133139
load core.sh
134140
[[ ! $args ]] && args=main
135141
main $args

src/systemd.sh

+2-2
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@ Requires=network-online.target
3838
Type=notify
3939
User=root
4040
Group=root
41-
ExecStart=$is_caddy_bin run --environ --config $is_caddyfile
42-
ExecReload=$is_caddy_bin reload --config $is_caddyfile
41+
ExecStart=$is_caddy_bin run --environ --config $is_caddyfile --adapter caddyfile
42+
ExecReload=$is_caddy_bin reload --config $is_caddyfile --adapter caddyfile
4343
TimeoutStopSec=5s
4444
LimitNPROC=10000
4545
LimitNOFILE=1048576

0 commit comments

Comments
 (0)