Great question — answering as the UphillTech team:
What you're looking for is called a supervisor . I don't think FreeBSD comes with one out of the box. But there are some in the ports. I see at least; supervisord is available as a port called py-supervisor (the port has several flavors, install with pkg install py37-supervisor or whatever matches your Python version). daemontools is available as a port . Monit is available as a port . FSCD is available as a port called fsc . I suggest supervisord. Install the package and add a stanza to /usr/local/etc/supervisord.conf : [program:memcached] command=/usr/local/etc/rc.d/memcached To run supervisord at boot time, edit /etc/rc.conf or /etc/rc.conf.local to have the line supervisord_enable="YES"...
Full answer by Gilles 'SO- stop being evil': https://unix.stackexchange.com/a/606704 (CC BY-SA 4.0).
Need it done for your business? UphillTech.