Skip to content

Commit 090bd04

Browse files
wulabingwulabing
wulabing
authored and
wulabing
committed
修复重复添加cron的问题
1 parent 88134c9 commit 090bd04

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

install.sh

+10-8
Original file line numberDiff line numberDiff line change
@@ -616,14 +616,16 @@ nginx_process_disabled() {
616616
#}
617617
acme_cron_update() {
618618
wget -N -P /usr/bin --no-check-certificate "https://raw.githubusercontent.com/wulabing/V2Ray_ws-tls_bash_onekey/dev/ssl_update.sh"
619-
if [[ "${ID}" == "centos" ]]; then
620-
# sed -i "/acme.sh/c 0 3 * * 0 \"/root/.acme.sh\"/acme.sh --cron --home \"/root/.acme.sh\" \
621-
# &> /dev/null" /var/spool/cron/root
622-
sed -i "/acme.sh/c 0 3 * * 0 bash ${ssl_update_file}" /var/spool/cron/root
623-
else
624-
# sed -i "/acme.sh/c 0 3 * * 0 \"/root/.acme.sh\"/acme.sh --cron --home \"/root/.acme.sh\" \
625-
# &> /dev/null" /var/spool/cron/crontabs/root
626-
sed -i "/acme.sh/c 0 3 * * 0 bash ${ssl_update_file}" /var/spool/cron/crontabs/root
619+
if [[ $(crontab -l | grep -c "ssl_update.sh") -lt 1 ]]; then
620+
if [[ "${ID}" == "centos" ]]; then
621+
# sed -i "/acme.sh/c 0 3 * * 0 \"/root/.acme.sh\"/acme.sh --cron --home \"/root/.acme.sh\" \
622+
# &> /dev/null" /var/spool/cron/root
623+
sed -i "/acme.sh/c 0 3 * * 0 bash ${ssl_update_file}" /var/spool/cron/root
624+
else
625+
# sed -i "/acme.sh/c 0 3 * * 0 \"/root/.acme.sh\"/acme.sh --cron --home \"/root/.acme.sh\" \
626+
# &> /dev/null" /var/spool/cron/crontabs/root
627+
sed -i "/acme.sh/c 0 3 * * 0 bash ${ssl_update_file}" /var/spool/cron/crontabs/root
628+
fi
627629
fi
628630
judge "cron 计划任务更新"
629631
}

0 commit comments

Comments
 (0)