From 4f47edc3bae1b4cc52ba57db741266525812b91f Mon Sep 17 00:00:00 2001 From: Whispering Wind <151555003+ReturnFI@users.noreply.github.com> Date: Thu, 8 May 2025 20:53:27 +0330 Subject: [PATCH] fix: replace old kick.sh cron job with new kick.py --- upgrade.sh | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/upgrade.sh b/upgrade.sh index 6f56e29..b87b47c 100644 --- a/upgrade.sh +++ b/upgrade.sh @@ -129,8 +129,13 @@ fi echo "Restoring cron jobs" crontab /tmp/crontab_backup echo "Updating kick.sh cron job to kick.py" -( crontab -l | sed "s|/etc/hysteria/core/scripts/hysteria2/kick.sh|/bin/bash -c 'source /etc/hysteria/hysteria2_venv/bin/activate && python3 /etc/hysteria/core/scripts/hysteria2/kick.py'|g" ) | crontab - -rm /tmp/crontab_backup +if crontab -l | grep -Fq '*/1 * * * * /etc/hysteria/core/scripts/hysteria2/kick.sh >/dev/null 2>&1'; then + crontab -l | grep -vF '*/1 * * * * /etc/hysteria/core/scripts/hysteria2/kick.sh >/dev/null 2>&1' | \ + { cat; echo "*/1 * * * * /bin/bash -c 'source /etc/hysteria/hysteria2_venv/bin/activate && python3 /etc/hysteria/core/scripts/hysteria2/kick.py' >/dev/null 2>&1"; } | crontab - + echo "Cron job updated." +else + echo "Old cron job not found. No need change." +fi chmod +x menu.sh ./menu.sh