#!/bin/sh # Runs the contact handler next to nginx. The handler is restarted if it crashes, but not when it # exits for missing configuration (code 78); the static site is served either way. ( cd /srv/contact || exit while :; do node contact.mjs code=$? [ "$code" -eq 78 ] && { echo "contact: not started, SMTP is not configured." >&2; exit; } echo "contact: exited with $code, restarting in 5 s." >&2 sleep 5 done ) & exec nginx -g 'daemon off;'