自动脚本忘写入cron

This commit is contained in:
lsy 2024-07-26 18:39:43 +08:00
parent 7a8ceb85ec
commit 8e81657f82
3 changed files with 12 additions and 1 deletions

View File

@ -109,7 +109,8 @@ EOF
chmod +x "$path/backup.sh"
declare cron_job="${cron} ${path}/backup.sh"
(crontab -l 2>/dev/null | grep -Fxq "${path}/backup.sh") || (crontab -l 2>/dev/null; echo "$cron_job") | sudo crontab -
(crontab -l 2>/dev/null | grep -v "backup.sh") | sudo crontab -
(crontab -l 2>/dev/null; echo "$cron_job") | sudo crontab -
sudo systemctl restart cron 2>> /dev/null || echo "自动任务重启失败"

View File

@ -22,4 +22,9 @@ EOF
esac
chmod +x "${path}/update.sh"
declare cron_job="${cron} ${path}/update.sh"
(crontab -l 2>/dev/null | grep -v "update.sh") | sudo crontab -
(crontab -l 2>/dev/null; echo "$cron_job") | sudo crontab -
sudo systemctl restart cron 2>> /dev/null || echo "自动任务重启失败"

View File

@ -53,6 +53,11 @@ for dir in "\$web_path"/*/; do
done
EOF
chmod +x "${path}/up-docker_compose.sh"
declare cron_job="${cron} ${path}/up-docker_compose.sh"
(crontab -l 2>/dev/null | grep -v "up-docker_compose.sh") | sudo crontab -
(crontab -l 2>/dev/null; echo "$cron_job") | sudo crontab -
sudo systemctl restart cron 2>> /dev/null || echo "自动任务重启失败"
;;
'4')