Skip to content

Instantly share code, notes, and snippets.

@jurajlutter
Last active November 15, 2024 12:02
Show Gist options
  • Save jurajlutter/ed9a8a3f7d0784aa288158d0f32cbade to your computer and use it in GitHub Desktop.
Save jurajlutter/ed9a8a3f7d0784aa288158d0f32cbade to your computer and use it in GitHub Desktop.
FreeBSD rc.d script for zigbee2mqtt
#!/bin/sh
#
# PROVIDE: z2m
# REQUIRE: NETWORKING
# KEYWORD: shutdown
#
# FreeBSD rc.d script for zigbee2mqtt
#
# (c) 2024 Juraj Lutter <otis@FreeBSD.org>
#
. /etc/rc.subr
name=z2m
desc="zigbee2mqtt service script"
rcvar=z2m_enable
load_rc_config $name
: ${z2m_enable:=NO}
: ${z2m_run_user=z2m}
: ${z2m_pidfile=/var/run/z2m.pid}
: ${z2m_home=/var/db/z2m}
z2m_chdir="${z2m_home}/run"
command=/usr/sbin/daemon
command_args="-f -H \
-p ${z2m_pidfile} -t ${name} -T ${name} \
-u ${z2m_run_user} -r -R 5 \
/usr/local/bin/node index.js"
procname=/usr/local/bin/node
required_files="${z2m_chdir}/data/configuration.yaml"
run_rc_command "$1"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment