=====
Setup
=====
-This section is incomplete.
+FIXME: This section is incomplete.
+
+
+System service
+==============
+When using systemd, you can let it run multiple worker instances when
+the system boots up:
+
+#. Copy files ``data/systemd/phinde*.service`` into ``/etc/systemd/system/``
+#. Adjust user and group names, and the work directories
+#. Enable three worker processes::
+
+ $ systemctl daemon-reload
+ $ systemctl enable phinde@1
+ $ systemctl enable phinde@2
+ $ systemctl enable phinde@3
+ $ systemctl enable phinde
+ $ systemctl start phinde
+#. Now three workers are running. Restarting the ``phinde`` service also
+ restarts the workers.
+
+
Cron job
========
--- /dev/null
+# This is a mostly empty service, but allows commands like stop, start, reload
+# to propagate to all phinde@ service instances.
+
+[Unit]
+Description=phinde search server
+After=network.target
+
+[Service]
+Type=oneshot
+RemainAfterExit=yes
+ExecStart=/bin/true
+ExecReload=/bin/true
+WorkingDirectory=/home/cweiske/www/search.cweiske.de/
+User=cweiske
+Group=www-cweiske
+
+[Install]
+WantedBy=multi-user.target
--- /dev/null
+[Unit]
+Description=phinde worker %i
+PartOf=phinde.service
+ReloadPropagatedFrom=phinde.service
+
+[Service]
+Type=simple
+WorkingDirectory=/home/cweiske/www/search.cweiske.de/
+User=cweiske
+Group=www-cweiske
+ExecStart=/home/cweiske/www/search.cweiske.de/bin/phinde-worker.php
+TimeoutStopSec=5
+Restart=always
+RestartSec=60
+
+[Install]
+WantedBy=phinde.service