FreeBSD: Daemonize a Script
I have written a simple NodeJS application and I would like to have FreeBSD launch it, and if the application ever crashes or terminates for any reason, relaunch it. The goal is for this application to be running as close to “eternally” as possible.
“daemon” Working as Expected, “daemon -r” Does Nothing
root@ELRBackend:/usr/local/etc/www # daemon node app > out.log root@ELRBackend:/usr/local/etc/www # ps -ux | grep node root 69099 0.8 0.4 666260 65388 – SsJ 10:31 0:00.19 node app root 69101 0.0 0.0 12872 2460 0 S+J 10:31 0:00.00 grep node root@ELRBackend:/usr/local/etc/www # kill 69099 root@ELRBackend:/usr/local/etc/www # daemon -r node app > out.log root@ELRBackend:/usr/local/etc/www # ps -ux | […]