mirror of
https://gitee.com/callmer/pve_toss_notes.git
synced 2026-08-31 14:02:53 +08:00
更新 Cronie 定时任务配置方法
This commit is contained in:
@@ -1,18 +1,21 @@
|
||||
## 下载加速规则安装脚本
|
||||
$ sudo curl -LR -o /usr/local/bin/dnsmasq-plugin.sh https://gitee.com/felixonmars/dnsmasq-china-list/raw/master/install.sh
|
||||
$ sudo curl -LR -o /usr/local/bin/dnsmasq-cnlist https://gitee.com/felixonmars/dnsmasq-china-list/raw/master/install.sh
|
||||
|
||||
## 设置脚本可执行权限
|
||||
$ sudo chmod +x /usr/local/bin/dnsmasq-plugin.sh
|
||||
$ sudo chmod +x /usr/local/bin/dnsmasq-cnlist
|
||||
|
||||
## 设置脚本文件防篡改
|
||||
$ sudo chattr +i /usr/local/bin/dnsmasq-plugin.sh
|
||||
$ sudo chattr +i /usr/local/bin/dnsmasq-cnlist
|
||||
|
||||
## 执行脚本
|
||||
$ sudo /usr/local/bin/dnsmasq-plugin.sh
|
||||
$ sudo /usr/local/bin/dnsmasq-cnlist
|
||||
|
||||
## 设置 crontab
|
||||
## 创建 Dnsmasq 规则更新任务
|
||||
$ sudo tee /etc/cron.d/dnsmasq-rules-update >/dev/null <<'EOF'
|
||||
25 9 * * * root /usr/bin/curl --retry-connrefused --retry 5 --retry-delay 5 --retry-max-time 60 -fsSLR -o /etc/dnsmasq.d/anti-ad.dnsmasq.conf https://anti-ad.net/anti-ad-for-dnsmasq.conf
|
||||
35 9 * * * root /usr/local/bin/dnsmasq-cnlist
|
||||
EOF
|
||||
|
||||
25 9 * * * /usr/bin/curl --retry-connrefused --retry 5 --retry-delay 5 --retry-max-time 60 -fsSLR -o /etc/dnsmasq.d/anti-ad.dnsmasq.conf https://anti-ad.net/anti-ad-for-dnsmasq.conf
|
||||
|
||||
35 9 * * * /usr/local/bin/dnsmasq-plugin.sh
|
||||
## 设置定时任务文件权限
|
||||
$ sudo chmod 0644 /etc/cron.d/dnsmasq-rules-update
|
||||
|
||||
|
||||
@@ -1,14 +1,19 @@
|
||||
# This configuration file is customized by fox,
|
||||
# Optimize SmartDNS crontab for local DNS server.
|
||||
## 创建 SmartDNS 规则更新任务
|
||||
$ sudo tee /etc/cron.d/smartdns-rules-update >/dev/null <<'EOF'
|
||||
20 9 * * * root /usr/bin/curl --retry-connrefused --retry 5 --retry-delay 5 --retry-max-time 60 -fsSLR -o /etc/smartdns.d/anti-ad.smartdns.conf https://anti-ad.net/anti-ad-for-smartdns.conf
|
||||
30 9 * * * root /usr/local/bin/smartdns-cnlist
|
||||
EOF
|
||||
|
||||
20 9 * * * /usr/bin/curl --retry-connrefused --retry 5 --retry-delay 5 --retry-max-time 60 -fsSLR -o /etc/smartdns.d/anti-ad.smartdns.conf https://anti-ad.net/anti-ad-for-smartdns.conf
|
||||
## 设置定时任务文件权限
|
||||
$ sudo chmod 0644 /etc/cron.d/smartdns-rules-update
|
||||
|
||||
30 9 * * * /usr/bin/systemctl restart smartdns.service
|
||||
## 或仅需重启 SmartDNS 服务本身
|
||||
|
||||
## 创建 SmartDNS 规则更新任务
|
||||
$ sudo tee /etc/cron.d/smartdns-rules-update >/dev/null <<'EOF'
|
||||
20 9 * * * root /usr/bin/curl --retry-connrefused --retry 5 --retry-delay 5 --retry-max-time 60 -fsSLR -o /etc/smartdns.d/anti-ad.smartdns.conf https://anti-ad.net/anti-ad-for-smartdns.conf
|
||||
30 9 * * * root /usr/bin/systemctl restart smartdns.service
|
||||
EOF
|
||||
|
||||
## Or when the SmartDNS China List installer is installed
|
||||
|
||||
20 9 * * * /usr/bin/curl --retry-connrefused --retry 5 --retry-delay 5 --retry-max-time 60 -fsSLR -o /etc/smartdns.d/anti-ad.smartdns.conf https://anti-ad.net/anti-ad-for-smartdns.conf
|
||||
|
||||
30 9 * * * /usr/local/bin/smartdns-cnlist
|
||||
|
||||
## 设置定时任务文件权限
|
||||
$ sudo chmod 0644 /etc/cron.d/smartdns-rules-update
|
||||
|
||||
Reference in New Issue
Block a user