2023-11-03 10:56:17 +08:00
|
|
|
[Unit]
|
|
|
|
Description=Iptables Helper
|
|
|
|
After=network.target
|
|
|
|
|
|
|
|
[Service]
|
|
|
|
Environment="HOME=/root"
|
2023-11-03 11:31:10 +08:00
|
|
|
WorkingDirectory=/opt/iptables-helper
|
2023-11-06 16:01:45 +08:00
|
|
|
ExecStartPre=/bin/bash -c "[ -f /etc/iptables.rule ] && iptables-restore /etc/iptables.rule || exit 0;"
|
2023-11-03 10:56:17 +08:00
|
|
|
ExecStart=/opt/iptables-helper/iptables-helper
|
2023-11-06 16:01:45 +08:00
|
|
|
ExecStartPost=/bin/bash -c "iptables-save | tee /etc/iptables.rule > /dev/null"
|
2023-11-03 10:56:17 +08:00
|
|
|
Restart=on-failure
|
2023-11-03 11:31:10 +08:00
|
|
|
KillMode=process
|
|
|
|
RestartSec=5s
|
2023-11-03 10:56:17 +08:00
|
|
|
|
|
|
|
[Install]
|
|
|
|
WantedBy=multi-user.target
|