#!/usr/bin/env bash set -euo pipefail # runit's run script for smallwebwaf, run again whenever smallwebwaf # exits; the wait spaces out the restarts. The state directory and every # file in it are given to the smallwebwaf user, so that a volume mounted # there needs no change of owner; chown -R changes a symbolic link itself, # never what it points to. exec, so that the signal `sv stop` sends # reaches smallwebwaf itself. main() { sleep 1 chown -R smallwebwaf:smallwebwaf "${SWWAF_STATE_DIR:-/var/lib/smallwebwaf}" exec chpst -u smallwebwaf:smallwebwaf /usr/local/bin/smallwebwaf } main "$@"