From 1bab13389821d3e51e9e18d0e82cad056b523c23 Mon Sep 17 00:00:00 2001 From: Robert Sesek Date: Sun, 18 Dec 2016 00:07:50 -0500 Subject: [PATCH] Add a systemd unit file for the server. --- deployment/mailpopbox.service | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 deployment/mailpopbox.service diff --git a/deployment/mailpopbox.service b/deployment/mailpopbox.service new file mode 100644 index 0000000..d9dd402 --- /dev/null +++ b/deployment/mailpopbox.service @@ -0,0 +1,17 @@ +[Unit] +Description=mailpopbox MX POP3/SMTP server. +Requires=network.target + +[Service] +Type=simple +ExecStartPre=/sbin/iptables -t nat -A PREROUTING -p tcp --dport 25 -j REDIRECT --to-ports 9025 +ExecStartPre=/sbin/iptables -t nat -A PREROUTING -p tcp --dport 995 -j REDIRECT --to-ports 9995 +ExecStart=/home/mailpopbox/mailpopbox /home/mailpopbox/mailpopbox.config +ExecStopPost=/sbin/iptables -t nat -D PREROUTING -p tcp --dport 995 -j REDIRECT --to-ports 9995 +ExecStopPost=/sbin/iptables -t nat -D PREROUTING -p tcp --dport 25 -j REDIRECT --to-ports 9025 +PermissionsStartOnly=true +User=mailpopbox +Group=mailpopbox + +[Install] +WantedBy=multi-user.target -- 2.43.5