27 lines
1.1 KiB
Desktop File
27 lines
1.1 KiB
Desktop File
[Unit]
|
|
Description=Mistborn Syncthing Service
|
|
Requires=Mistborn-base.service
|
|
After=Mistborn-base.service
|
|
PartOf=Mistborn-base.service
|
|
|
|
[Service]
|
|
Restart=always
|
|
User=root
|
|
Group=docker
|
|
PermissionsStartOnly=true
|
|
# Shutdown container (if running) when unit is stopped
|
|
ExecStartPre=/opt/mistborn/scripts/wrappers/mistborn_docker.sh syncthing docker-compose -f /opt/mistborn/extra/syncthing.yml down
|
|
|
|
ExecStartPre=/sbin/iptables -w -I DOCKER-USER -i DIFACE -p udp --dport 21027 -j MISTBORN_LOG_DROP
|
|
ExecStartPre=/sbin/iptables -w -I DOCKER-USER -i DIFACE -p tcp --dport 22000 -j MISTBORN_LOG_DROP
|
|
# Start container when unit is started
|
|
ExecStart=/opt/mistborn/scripts/wrappers/mistborn_docker.sh syncthing docker-compose -f /opt/mistborn/extra/syncthing.yml up --build
|
|
# Stop container when unit is stopped
|
|
ExecStop=/opt/mistborn/scripts/wrappers/mistborn_docker.sh syncthing docker-compose -f /opt/mistborn/extra/syncthing.yml down
|
|
# Post stop
|
|
ExecStopPost=-/sbin/iptables -D DOCKER-USER -i DIFACE -p udp --dport 21027 -j MISTBORN_LOG_DROP
|
|
ExecStopPost=-/sbin/iptables -D DOCKER-USER -i DIFACE -p tcp --dport 22000 -j MISTBORN_LOG_DROP
|
|
|
|
[Install]
|
|
WantedBy=multi-user.target
|