On Thu, Aug 06, 2020 at 09:44:24AM +0300, Otto Kekäläinen wrote: > Is it possible to send email using the Postfix provided > /usr/sbin/sendmail command on a system where Postfix is installed, but > not running permanently as a service?
Not the upstream Postfix version signed by Wietse. Apple have (had?) a modified Postfix Postfix version that does support idling down when the mail queue is empty. For that you need an "inotify" daemon that watches the queue directory, waking up only as files are added or deleted. It needs to be very robust, never getting out of sync with the queue contents. So long as the maildrop, incoming, active or deferred queues are non-empty, Postfix should be running. Once all four are empty Postfix can be stopped, to be restarted once a new file lands in the maildrop directory. A doable, but perhaps non-trivial, programming project would be to start with Apple's Postfix sources, and port that functionality to BSD and/or Linux. When there's no new mail, the cost of running Postfix is that the queue manager and pickup "wake up" periodically, to scan the queue directory for new messages. This can prevent battery-powered devices from entering an energy-saving sleep mode. Otherwise, provided max_idle is less than the wakeup timer for "pickup", the cost is modest. Postfix idles down to just 3 processes: /usr/local/libexec/postfix/master -w qmgr -l -t unix -u pickup -l -t unix -u with pickup(8) waking up every 60 seconds by default (see master.cf(5)) and qmgr(8) waking up to scan the queue every 300 seconds. You can reduce the cost of qmgr scans by disabling hashing of the deferred queue after stopping Postfix, and then restarting. hash_queue_names = -- Viktor.