diff --git a/deploy.sh b/deploy.sh index fa80665..340d093 100644 --- a/deploy.sh +++ b/deploy.sh @@ -43,8 +43,11 @@ chmod -R 775 public/uploads 2>/dev/null || true # 平滑重载 PHP-FPM 刷新 OPcache 字节码缓存 if [ -x "/etc/init.d/php-fpm-73" ]; then - echo "[${DATE}] 平滑重载 PHP-FPM 7.3..." >> "${LOG_FILE}" - /etc/init.d/php-fpm-73 reload >> "${LOG_FILE}" 2>&1 || true + if command -v sudo >/dev/null 2>&1; then + sudo /etc/init.d/php-fpm-73 reload >> "${LOG_FILE}" 2>&1 || true + else + /etc/init.d/php-fpm-73 reload >> "${LOG_FILE}" 2>&1 || true + fi fi COMMIT_INFO=$(git log -1 --pretty=format:"%h - %s (%an, %cd)")