#!/bin/bash # glibc silently ignores a malformed MALLOC_ARENA_MAX, so refuse it here. if [[ -n "${MALLOC_ARENA_MAX:-}" && ! "$MALLOC_ARENA_MAX" =~ ^[1-9][0-9]*$ ]]; then echo "MALLOC_ARENA_MAX must be a positive whole number, got '$MALLOC_ARENA_MAX'" >&2 exit 1 fi cd /var/lib/berlin.sneak.app.routewatch chown -R routewatch:routewatch . chmod 700 . # setpriv replaces itself with the daemon, so the daemon receives the stop # signal directly. runuser would stay in between and kill the daemon 2 seconds # after passing the signal on. exec setpriv --reuid=routewatch --regid=routewatch --init-groups -- /app/routewatch