Daemontools on Centos 7

Cut’n’paste from http://www.productionmonkeys.net/guides/qmail-server/daemontools

CentOS 7 uses systemd

Create a new file /etc/systemd/system/daemontools.service, with the startup code in it:

[Unit]
Description=daemontools Start supervise
After=getty.target
[Service]
Type=simple
User=root
Group=root
Restart=always
ExecStart=/command/svscanboot /dev/ttyS0
TimeoutSec=0
[Install]
WantedBy=multi-user.target

Start the service:

systemctl start daemontools.service

Test that it is running:

systemctl status daemontools.service

Enable it to start at boot:

systemctl enable daemontools.service

WeakHashMap

Every once in a while I need a HashMap with weakly referenced values. But since the standard HashMap with weak references in Java only has weak keys, which I never found any use for so far, I find myself googeling for an implementation I can cut n paste into my projects every time I need one.

Last time I needed one I found MapMaker i Guava. So this is a note to myself for next time.

Map<String, Object> map = new MapMaker().weakValues().makeMap();