Skip to content

Instantly share code, notes, and snippets.

@pavax
Last active July 30, 2024 21:17
Show Gist options
  • Save pavax/f31c0947eeb950754a565facfcc2bb7e to your computer and use it in GitHub Desktop.
Save pavax/f31c0947eeb950754a565facfcc2bb7e to your computer and use it in GitHub Desktop.
udpbroadcastrelay freebsd service
#!/bin/sh
# How to use:
# Place this file in /usr/local/etc/rc.d/
# Make the file executable: chmod +x /usr/local/etc/rc.d/udpbroadcastrelay2
# Adjust the command_args to your needs
# Add udpbroadcastrelay_enable="YES" to /etc/rc.config
# Start using the command: service udpbroadcastrelay start
. /etc/rc.subr
name=udpbroadcastrelay
rcvar=udpbroadcastrelay_enable
# RC.config vars
load_rc_config $name
: ${udpbroadcastrelay_enable="NO"}
: ${udpbroadcastrelay_runAs="root"}
pidfile="/var/run/${name}_d.pid"
output_file="/var/log/${name}.log"
exec_path="/usr/local/sbin/udpbroadcastrelay"
exec_args="--id 42 --dev igc1 --dev igc1.20 --port 1900 --multicast 239.255.255.250 -s 1.1.1.2 --msearch proxy -f"
# Command
command="/usr/sbin/daemon"
command_args="-r -t ${name} -u ${udpbroadcastrelay_runAs} -o ${output_file} -P ${pidfile} ${exec_path} ${exec_args}"
# Loading Config
load_rc_config ${name}
run_rc_command "$1"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment