hysteria-scheduler service setup

- Create installation script to automate setup and migration from cron
- Update both install.sh and upgrade.sh to use the shared functions
This commit is contained in:
Whispering Wind
2025-05-15 23:10:08 +03:30
committed by GitHub
parent 08f90a3246
commit 61874a4acc
3 changed files with 61 additions and 36 deletions

View File

@ -2,6 +2,7 @@
source /etc/hysteria/core/scripts/path.sh
source /etc/hysteria/core/scripts/utils.sh
source /etc/hysteria/core/scripts/scheduler_setup.sh
define_colors
install_hysteria() {
@ -82,11 +83,9 @@ install_hysteria() {
chmod +x /etc/hysteria/core/scripts/hysteria2/user.sh
chmod +x /etc/hysteria/core/scripts/hysteria2/kick.py
(crontab -l ; echo "*/1 * * * * /bin/bash -c 'source /etc/hysteria/hysteria2_venv/bin/activate && python3 /etc/hysteria/core/cli.py traffic-status --no-gui'") | crontab -
# (crontab -l ; echo "0 3 */3 * * /bin/bash -c 'source /etc/hysteria/hysteria2_venv/bin/activate && python3 /etc/hysteria/core/cli.py restart-hysteria2' >/dev/null 2>&1") | crontab -
(crontab -l ; echo "0 */6 * * * /bin/bash -c 'source /etc/hysteria/hysteria2_venv/bin/activate && python3 /etc/hysteria/core/cli.py backup-hysteria' >/dev/null 2>&1") | crontab -
# (crontab -l ; 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 -
if ! check_scheduler_service; then
setup_hysteria_scheduler
fi
}
if systemctl is-active --quiet hysteria-server.service; then