Ho modificato lo startup script distribuito da Dovecot e l'ho salvato come /usr/local/bin/dovecotctl:
#!/bin/bash
### BEGIN INIT INFO
# Provides: dovecot
# Required-Start: $local_fs $remote_fs $network $syslog $time
# Required-Stop: $local_fs $remote_fs $network $syslog
# Should-Start: postgresql mysql slapd winbind
# Should-Stop: postgresql mysql slapd winbind
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Dovecot init script
# Description: Init script for dovecot services
### END INIT INFO
# Example /etc/init.d/dovecot script. Change DAEMON if necessary.
# License is public domain.
DAEMON=/usr/local/dovecot/sbin/dovecot
# Uncomment to allow Dovecot daemons to produce core dumps.
#ulimit -c unlimited
test -x $DAEMON || exit 1
set -e
base_dir=`$DAEMON config -h base_dir`
pidfile=$base_dir/master.pid
if test -f $pidfile; then
running=yes
else
running=no
fi
case "$1" in
start)
echo -n "Starting Dovecot"
$DAEMON
echo "."
;;
stop)
if test $running = yes; then
echo "Stopping Dovecot"
kill `cat $pidfile`
echo "."
else
echo "Dovecot is already stopped."
fi
;;
reload)
if test $running = yes; then
echo -n "Reloading Dovecot configuration"
kill -HUP `cat $pidfile`
echo "."
else
echo "Dovecot isn't running."
fi
;;
restart|force-reload)
echo -n "Restarting Dovecot"
if test $running = yes; then
kill `cat $pidfile`
sleep 1
fi
$DAEMON
echo "."
;;
*)
echo "Usage: dovecotctl {start|stop|reload|restart|force-reload}" >&2
exit 1
;;
esac
exit 0
wget -O /usr/local/bin/dovecotctl https://notes.sagredo.eu/files/qmail/dovecot/dovecotctl chmod +x /usr/local/bin/dovecotctl
Avviamo Dovecot e questo è quello che si dovrebbe vedere :
> dovecotctl
Usage: dovecotctl {start|stop|reload|restart|force-reload}
> dovecotctl start
Starting Dovecot.
> ps axfu | grep dovecot
root 372 0.0 0.0 9508 3308 ? Ss Dec18 0:01 /usr/local/dovecot/sbin/dovecot
root 373 0.0 0.0 9324 4108 ? S Dec18 0:00 \_ dovecot/anvil
root 374 0.0 0.0 9296 4068 ? S Dec18 0:01 \_ dovecot/log
root 375 0.0 0.0 55048 12640 ? S Dec18 0:00 \_ dovecot/config
dovecot 457 0.0 0.0 9488 4144 ? S Dec18 0:00 \_ dovecot/stats
vpopmail 348163 0.0 0.0 14424 8496 ? S 09:32 0:00 \_ dovecot/imap-login
vpopmail 348164 0.0 0.0 58768 15028 ? S 09:32 0:00 \_ dovecot/imap postlogin
vpopmail 355245 0.0 0.0 14424 8516 ? S 14:16 0:00 \_ dovecot/imap-login
vpopmail 355246 0.0 0.0 56504 14396 ? S 14:17 0:00 \_ dovecot/imap postlogin
Lanciare Dovecot al boot
Per lanciare Dovecot all'avvio del server è sufficiente aggiungere una riga come questa nel file rc.local
/usr/local/bin/dovecotctl start &
In caso, come è molto probabile, ti trovi in un sistema basato su systemd, il file rc.local è salvato in /etc/rc.local e dovrai istruire systemd affinchè esso venga eseguito all'avvio della macchina. Per ricordare come si fa sei invitato a leggere questo commento (grazie a GoofY).
E' importante settare il proprio rc.local perchè da ora in poi tutti i servizi verranno lancoati all'avvio da questo script e non da daemontools.
Dovecot sotto daemontools
Se si vuole far girare Dovecot sotto daemontools leggere le indicazione spoegate in questo commento.

