Files
route-switcher/route-switcher.service
Michal Humpula 5fbd72b370 working base
2026-02-15 17:36:08 +01:00

45 lines
1.0 KiB
Desktop File

[Unit]
Description=Route-Switcher - Automatic network failover service
Documentation=https://git.hudrydum.cz/michal.humpula/route-switcher
After=network.target network-online.target
Wants=network-online.target
ConditionPathExists=/usr/local/sbin/route-switcher
[Service]
Type=simple
ExecStart=/usr/local/sbin/route-switcher
Restart=always
RestartSec=5
StandardOutput=journal
StandardError=journal
# Environment variables (customize these for your network)
Environment=RUST_LOG=info
Environment=PRIMARY_INTERFACE=eth0
Environment=SECONDARY_INTERFACE=eth1
Environment=PRIMARY_GATEWAY=192.168.1.1
Environment=SECONDARY_GATEWAY=192.168.2.1
Environment=PING_TARGET=8.8.8.8
User=root
Group=root
CapabilityBoundingSet=CAP_NET_ADMIN CAP_NET_RAW
AmbientCapabilities=CAP_NET_ADMIN CAP_NET_RAW
NoNewPrivileges=true
# Resource limits
LimitNOFILE=65536
LimitNPROC=4096
# Process isolation
ProtectSystem=strict
ProtectHome=true
ReadWritePaths=/var/log
PrivateTmp=true
ProtectKernelTunables=true
ProtectControlGroups=true
RestrictRealtime=true
[Install]
WantedBy=multi-user.target