Skip to content

Instantly share code, notes, and snippets.

@sistematico
Forked from wwwdata/gist:11217377
Last active January 12, 2024 18:19
Show Gist options
  • Save sistematico/5cdd355bcf8ef338929d1a8573db5a61 to your computer and use it in GitHub Desktop.
Save sistematico/5cdd355bcf8ef338929d1a8573db5a61 to your computer and use it in GitHub Desktop.
FreeBSD service script for Node.js
#!/bin/sh
# PROVIDE: nodejs
# REQUIRE: NETWORKING SERVERS DAEMON
# BEFORE: LOGIN
# File: /etc/rc.d/nodejs
# https://docs.freebsd.org/en/articles/rc-scripting
# https://man.freebsd.org/cgi/man.cgi?query=daemon
# https://forums.freebsd.org/threads/beep-on-sucessful-bootup.64145/#post-394617
. /etc/rc.subr
name="nodejs"
rcvar=${name}_enable
entrypoint="/www/testserver/start.js"
pidfile="/var/run/testserver.pid"
command="/usr/sbin/daemon"
command_args="-r -f -u www -t 'Testserver Daemon' -P ${pidfile} -o /www/testserver/daemon.log -r /usr/local/bin/node ${entrypoint}"
#command_args="-P ${pidfile} -R 10 -f -u ${overseerr_user} ${overseerr_command} ${overseerr_args}"
load_rc_config $name
: ${nodejs_enable:=no}
run_rc_command "$1"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment