Now for quite a while I've been suffering through DavMail just quitting on me. Nothing gets logged anywhere, the pid just dies. However today in #systemadmins I tossed out a question and it was fielded by a guy who I'd consider quite the senior in the whole *nix/SysAdmin world. Dude took less than 20 minutes and had me a working systemd.service file that will run automagically and restart if it happens to die, oh and get this.. it will LOG too! *giggle*
Here's the file for those interested:
[Unit]
Description=DavMail Exchange Gateway
Requires=network.target
After=network.target
[Service]
Type=simple
RemainAfterExit=no
#ExecStart=/usr/bin/davmail /etc/conf.d/davmail.properties
#ExecStop=killall davmail
Environment=BASE=/path/to/davmail-linux-x86_64-4.8.0-2479/
Environment=PROPERTIES=/path/to/.davmail.properties
ExecStartPre=/usr/bin/bash -c "for i in $BASE/lib/*; do /usr/bin/systemctl set-environment CLASSPATH=${CLASSPATH}:$i ; done"
ExecStart=/usr/bin/java -Xms1G -Xmx1G -Djava.awt.headless=true -XX:ErrorFile=/tmp/davmail_errors.log -XX:-HeapDumpOnOutOfMemoryError -Dsun.net.inetaddr.ttl=60 -cp ${BASE}/davmail.jar:${CLASSPATH} davmail.DavGateway ${PROPERTIES}
Restart=always
RestartSec=3
[Install]
WantedBy=multi-user.target