#!/bin/sh /etc/rc.common

START=50

USE_PROCD=1

UHTTPD_BIN="/usr/sbin/uhttpd"

start_service() {
  procd_open_instance
  procd_set_param command $UHTTPD_BIN -k 0 -f -h /www/pirania-redirect/ -E / -l / -L /www/pirania-redirect/redirect  -n 20 -p 59080
  # respawn automatically if something died, be careful if you have an alternative process supervisor
  # if process dies sooner than respawn_threshold, it is considered crashed and after 5 retries the service is stopped
  procd_set_param respawn ${respawn_threshold:-3600} ${respawn_timeout:-5} ${respawn_retry:-5}

  procd_set_param stderr 1 # forward stderr of the command to logd
  procd_close_instance
}
