Hi,
Recently, I switched to systemd, kind of stuck with configuring
fetchmail to start/stop. Is anyone able to read variable from any one of
the config files in /etc/conf.d/ directory and use it in systemd's unit
file? like, reading 'polling_period' from /etc/conf.d/fetchmail?
I end-up writing my own script to start fetchmail and integrated into
systemd,
/etc/init.d/fetchmail.systemd: (must be executable - 700)
------------------------------
#!/bin/sh
source /etc/conf.d/fetchmail
pid_file=/var/lib/fetchmail/fetchmail.pid
rcfile=/etc/fetchmailrc
fidfile=/var/lib/fetchmail/.fetchids
start()
{
/usr/bin/fetchmail -d ${polling_period} -f ${rcfile} --pidfile
${pid_file} -i ${fidfile}
}
/etc/systemd/system/fetchmail.service:
--------------------------------------
[Unit]
Description=A remote-mail retrieval utility
After=NetworkManager-wait-online.service
[Service]
Type=forking
User=fetchmail
ExecStart=/etc/init.d/fetchmail.systemd start
[Install]
WantedBy=multi-user.target
If anyone have better solution for fetchmail. Please let me know.
Thanks,
MOhan R