From c3cdb5f9d9618e93bbf4c88f5785e187d870b4e1 Mon Sep 17 00:00:00 2001 From: libm Date: Wed, 7 May 2025 13:54:22 +0800 Subject: [PATCH] fix: optimize the crontab command to fix issue #135 --- script/clashctl.sh | 2 +- script/common.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/script/clashctl.sh b/script/clashctl.sh index b49d503..365beee 100644 --- a/script/clashctl.sh +++ b/script/clashctl.sh @@ -172,7 +172,7 @@ function clashupdate() { # 如果是自动更新模式,则设置定时任务 [ "$is_auto" = true ] && { - sudo grep -qs 'clashupdate' "$CLASH_CRON_TAB" || echo "0 0 */2 * * . $SHELL_RC;clashupdate $url" | sudo tee -a "$CLASH_CRON_TAB" >&/dev/null + sudo grep -qs 'clashupdate' "$CLASH_CRON_TAB" || echo "0 0 */2 * * $_SHELL -i -c '. $SHELL_RC;clashupdate $url'" | sudo tee -a "$CLASH_CRON_TAB" >&/dev/null _okcat "已设置定时更新订阅" && return 0 } diff --git a/script/common.sh b/script/common.sh index cff0973..0473758 100644 --- a/script/common.sh +++ b/script/common.sh @@ -321,7 +321,7 @@ _start_convert() { local newPort=$(_get_random_port) _failcat '🎯' "端口占用:$BIN_SUBCONVERTER_PORT 🎲 随机分配:$newPort" [ ! -e "$BIN_SUBCONVERTER_CONFIG" ] && { - sudo /bin/mv -f "$BIN_SUBCONVERTER_DIR/pref.example.yml" "$BIN_SUBCONVERTER_CONFIG" + sudo /bin/cp -f "$BIN_SUBCONVERTER_DIR/pref.example.yml" "$BIN_SUBCONVERTER_CONFIG" } sudo "$BIN_YQ" -i ".server.port = $newPort" "$BIN_SUBCONVERTER_CONFIG" BIN_SUBCONVERTER_PORT=$newPort