iptables-helper/iptables-helper.service
zxb 56f99332d8 服务配置调整
启动服务时加载已保存的规则文件
2023-11-03 11:31:10 +08:00

16 lines
434 B
Desktop File

[Unit]
Description=Iptables Helper
After=network.target
[Service]
Environment="HOME=/root"
WorkingDirectory=/opt/iptables-helper
ExecStartPre=sh -c "[ -f /etc/iptables.rule ] && iptables-restore /etc/iptables.rule || exit 0;"
ExecStart=/opt/iptables-helper/iptables-helper
ExecStartPost=sh -c "iptables-save | tee /etc/iptables.rule > /dev/null"
Restart=on-failure
KillMode=process
RestartSec=5s
[Install]
WantedBy=multi-user.target