From b68f5828b0233671a9840f0424fe832d7f9b0f03 Mon Sep 17 00:00:00 2001 From: FusionPBX Date: Tue, 12 May 2026 03:46:26 +0000 Subject: [PATCH] Add FreeBSD rc.d service files --- .../resources/service/freebsd.service | 65 ++++++++++++++++++ .../resources/service/freebsd.service | 65 ++++++++++++++++++ .../resources/service/freebsd.service | 65 ++++++++++++++++++ .../resources/service/freebsd.service | 65 ++++++++++++++++++ .../resources/service/freebsd.service | 66 +++++++++++++++++++ .../resources/service/freebsd.service | 65 ++++++++++++++++++ app/system/resources/service/freebsd.service | 65 ++++++++++++++++++ app/xml_cdr/resources/service/freebsd.service | 65 ++++++++++++++++++ .../resources/service/freebsd.service | 65 ++++++++++++++++++ 9 files changed, 586 insertions(+) create mode 100644 app/active_calls/resources/service/freebsd.service create mode 100644 app/active_conferences/resources/service/freebsd.service create mode 100644 app/email_queue/resources/service/freebsd.service create mode 100644 app/event_guard/resources/service/freebsd.service create mode 100644 app/fax_queue/resources/service/freebsd.service create mode 100644 app/operator_panel/resources/service/freebsd.service create mode 100644 app/system/resources/service/freebsd.service create mode 100644 app/xml_cdr/resources/service/freebsd.service create mode 100644 core/websockets/resources/service/freebsd.service diff --git a/app/active_calls/resources/service/freebsd.service b/app/active_calls/resources/service/freebsd.service new file mode 100644 index 000000000..d1e3404b7 --- /dev/null +++ b/app/active_calls/resources/service/freebsd.service @@ -0,0 +1,65 @@ +#!/bin/sh +# +# PROVIDE: active_calls +# REQUIRE: DAEMON +# KEYWORD: shutdown +# +# Add the following lines to /etc/rc.conf to enable active_calls: +# active_calls_enable: Set it to "YES" to enable active_calls. +# Default is "NO". +# + +. /etc/rc.subr +name="active_calls" + +rcvar=${name}_enable +load_rc_config $name + +# Set defaults +: ${active_calls_enable="NO"} +: ${active_calls_pidfile="/var/run/active_calls.pid"} + +# Prepare the variables +start_cmd=${name}_start +stop_cmd=${name}_stop +status_cmd=${name}_status +pidfile=${active_calls_pidfile} + +# Path to the PHP script +script="/usr/local/www/fusionpbx/app/active_calls/resources/service/active_calls.php" + +# Command to run the script +command="/usr/local/bin/php" +command_args="$script > /dev/null 2>&1" + +active_calls_start() { + echo "Starting $name..." + if [ -f "$pidfile" ] && kill -0 "$(cat $pidfile)" 2>/dev/null; then + echo "$name is already running." + else + $command $command_args & + echo $! > "$pidfile" + echo "$name started." + fi +} + +active_calls_stop() { + echo "Stopping $name..." + if [ -f "$pidfile" ] && kill -0 "$(cat $pidfile)" 2>/dev/null; then + kill "$(cat $pidfile)" + rm -f "$pidfile" + echo "$name stopped." + else + echo "$name is not running." + fi +} + +active_calls_status() { + if [ -f "$pidfile" ] && kill -0 "$(cat $pidfile)" 2>/dev/null; then + echo "$name is running with PID $(cat $pidfile)." + else + echo "$name is not running." + fi +} + +run_rc_command "$1" diff --git a/app/active_conferences/resources/service/freebsd.service b/app/active_conferences/resources/service/freebsd.service new file mode 100644 index 000000000..3c095846f --- /dev/null +++ b/app/active_conferences/resources/service/freebsd.service @@ -0,0 +1,65 @@ +#!/bin/sh +# +# PROVIDE: active_conferences +# REQUIRE: DAEMON +# KEYWORD: shutdown +# +# Add the following lines to /etc/rc.conf to enable active_conferences: +# active_conferences_enable: Set it to "YES" to enable active_conferences. +# Default is "NO". +# + +. /etc/rc.subr +name="active_conferences" + +rcvar=${name}_enable +load_rc_config $name + +# Set defaults +: ${active_conferences_enable="NO"} +: ${active_conferences_pidfile="/var/run/active_conferences.pid"} + +# Prepare the variables +start_cmd=${name}_start +stop_cmd=${name}_stop +status_cmd=${name}_status +pidfile=${active_conferences_pidfile} + +# Path to the PHP script +script="/usr/local/www/fusionpbx/app/active_conferences/resources/service/active_conferences.php" + +# Command to run the script +command="/usr/local/bin/php" +command_args="$script > /dev/null 2>&1" + +active_conferences_start() { + echo "Starting $name..." + if [ -f "$pidfile" ] && kill -0 "$(cat $pidfile)" 2>/dev/null; then + echo "$name is already running." + else + $command $command_args & + echo $! > "$pidfile" + echo "$name started." + fi +} + +active_conferences_stop() { + echo "Stopping $name..." + if [ -f "$pidfile" ] && kill -0 "$(cat $pidfile)" 2>/dev/null; then + kill "$(cat $pidfile)" + rm -f "$pidfile" + echo "$name stopped." + else + echo "$name is not running." + fi +} + +active_conferences_status() { + if [ -f "$pidfile" ] && kill -0 "$(cat $pidfile)" 2>/dev/null; then + echo "$name is running with PID $(cat $pidfile)." + else + echo "$name is not running." + fi +} + +run_rc_command "$1" diff --git a/app/email_queue/resources/service/freebsd.service b/app/email_queue/resources/service/freebsd.service new file mode 100644 index 000000000..388e97a98 --- /dev/null +++ b/app/email_queue/resources/service/freebsd.service @@ -0,0 +1,65 @@ +#!/bin/sh +# +# PROVIDE: email_queue +# REQUIRE: DAEMON +# KEYWORD: shutdown +# +# Add the following lines to /etc/rc.conf to enable email_queue: +# email_queue_enable: Set it to "YES" to enable email_queue. +# Default is "NO". +# + +. /etc/rc.subr +name="email_queue" + +rcvar=${name}_enable +load_rc_config $name + +# Set defaults +: ${email_queue_enable="NO"} +: ${email_queue_pidfile="/var/run/email_queue.pid"} + +# Prepare the variables +start_cmd=${name}_start +stop_cmd=${name}_stop +status_cmd=${name}_status +pidfile=${email_queue_pidfile} + +# Path to the PHP script +script="/usr/local/www/fusionpbx/app/email_queue/resources/service/email_queue.php" + +# Command to run the script +command="/usr/local/bin/php" +command_args="$script > /dev/null 2>&1" + +email_queue_start() { + echo "Starting $name..." + if [ -f "$pidfile" ] && kill -0 "$(cat $pidfile)" 2>/dev/null; then + echo "$name is already running." + else + $command $command_args & + echo $! > "$pidfile" + echo "$name started." + fi +} + +email_queue_stop() { + echo "Stopping $name..." + if [ -f "$pidfile" ] && kill -0 "$(cat $pidfile)" 2>/dev/null; then + kill "$(cat $pidfile)" + rm -f "$pidfile" + echo "$name stopped." + else + echo "$name is not running." + fi +} + +email_queue_status() { + if [ -f "$pidfile" ] && kill -0 "$(cat $pidfile)" 2>/dev/null; then + echo "$name is running with PID $(cat $pidfile)." + else + echo "$name is not running." + fi +} + +run_rc_command "$1" diff --git a/app/event_guard/resources/service/freebsd.service b/app/event_guard/resources/service/freebsd.service new file mode 100644 index 000000000..753fb7101 --- /dev/null +++ b/app/event_guard/resources/service/freebsd.service @@ -0,0 +1,65 @@ +#!/bin/sh +# +# PROVIDE: event_guard +# REQUIRE: DAEMON +# KEYWORD: shutdown +# +# Add the following lines to /etc/rc.conf to enable event_guard: +# event_guard_enable: Set it to "YES" to enable event_guard. +# Default is "NO". +# + +. /etc/rc.subr +name="event_guard" + +rcvar=${name}_enable +load_rc_config $name + +# Set defaults +: ${event_guard_enable="NO"} +: ${event_guard_pidfile="/var/run/event_guard.pid"} + +# Prepare the variables +start_cmd=${name}_start +stop_cmd=${name}_stop +status_cmd=${name}_status +pidfile=${event_guard_pidfile} + +# Path to the PHP script +script="/usr/local/www/fusionpbx/app/event_guard/resources/service/event_guard.php" + +# Command to run the script +command="/usr/local/bin/php" +command_args="$script > /dev/null 2>&1" + +event_guard_start() { + echo "Starting $name..." + if [ -f "$pidfile" ] && kill -0 "$(cat $pidfile)" 2>/dev/null; then + echo "$name is already running." + else + $command $command_args & + echo $! > "$pidfile" + echo "$name started." + fi +} + +event_guard_stop() { + echo "Stopping $name..." + if [ -f "$pidfile" ] && kill -0 "$(cat $pidfile)" 2>/dev/null; then + kill "$(cat $pidfile)" + rm -f "$pidfile" + echo "$name stopped." + else + echo "$name is not running." + fi +} + +event_guard_status() { + if [ -f "$pidfile" ] && kill -0 "$(cat $pidfile)" 2>/dev/null; then + echo "$name is running with PID $(cat $pidfile)." + else + echo "$name is not running." + fi +} + +run_rc_command "$1" diff --git a/app/fax_queue/resources/service/freebsd.service b/app/fax_queue/resources/service/freebsd.service new file mode 100644 index 000000000..16c8e6224 --- /dev/null +++ b/app/fax_queue/resources/service/freebsd.service @@ -0,0 +1,66 @@ +#!/bin/sh +# +# PROVIDE: fax_queue +# REQUIRE: DAEMON +# KEYWORD: shutdown +# +# Add the following lines to /etc/rc.conf to enable fax_queue: +# fax_queue_enable: Set it to "YES" to enable fax_queue. +# Default is "NO". +# + +. /etc/rc.subr +name="fax_queue" + +rcvar=${name}_enable +load_rc_config $name + +# Set defaults +: ${fax_queue_enable="NO"} +: ${fax_queue_pidfile="/var/run/fax_queue.pid"} + +# Prepare the variables +start_cmd=${name}_start +stop_cmd=${name}_stop +status_cmd=${name}_status +pidfile=${fax_queue_pidfile} + +# Path to the PHP script +script="/usr/local/www/fusionpbx/app/fax_queue/resources/service/fax_queue.php" + +# Command to run the script +command="/usr/local/bin/php" +command_args="$script > /dev/null 2>&1" + +fax_queue_start() { + echo "Starting $name..." + if [ -f "$pidfile" ] && kill -0 "$(cat $pidfile)" 2>/dev/null; then + echo "$name is already running." + else + $command $command_args & + echo $! > "$pidfile" + echo "$name started." + fi +} + +fax_queue_stop() { + echo "Stopping $name..." + if [ -f "$pidfile" ] && kill -0 "$(cat $pidfile)" 2>/dev/null; then + kill "$(cat $pidfile)" + rm -f "$pidfile" + echo "$name stopped." + else + echo "$name is not running." + fi +} + +fax_queue_status() { + if [ -f "$pidfile" ] && kill -0 "$(cat $pidfile)" 2>/dev/null; then + echo "$name is running with PID $(cat $pidfile)." + else + echo "$name is not running." + fi +} + +run_rc_command "$1" + diff --git a/app/operator_panel/resources/service/freebsd.service b/app/operator_panel/resources/service/freebsd.service new file mode 100644 index 000000000..b33968f45 --- /dev/null +++ b/app/operator_panel/resources/service/freebsd.service @@ -0,0 +1,65 @@ +#!/bin/sh +# +# PROVIDE: operator_panel +# REQUIRE: DAEMON +# KEYWORD: shutdown +# +# Add the following lines to /etc/rc.conf to enable operator_panel: +# operator_panel_enable: Set it to "YES" to enable operator_panel. +# Default is "NO". +# + +. /etc/rc.subr +name="operator_panel" + +rcvar=${name}_enable +load_rc_config $name + +# Set defaults +: ${operator_panel_enable="NO"} +: ${operator_panel_pidfile="/var/run/operator_panel.pid"} + +# Prepare the variables +start_cmd=${name}_start +stop_cmd=${name}_stop +status_cmd=${name}_status +pidfile=${operator_panel_pidfile} + +# Path to the PHP script +script="/usr/local/www/fusionpbx/app/operator_panel/resources/service/operator_panel.php" + +# Command to run the script +command="/usr/local/bin/php" +command_args="$script > /dev/null 2>&1" + +operator_panel_start() { + echo "Starting $name..." + if [ -f "$pidfile" ] && kill -0 "$(cat $pidfile)" 2>/dev/null; then + echo "$name is already running." + else + $command $command_args & + echo $! > "$pidfile" + echo "$name started." + fi +} + +operator_panel_stop() { + echo "Stopping $name..." + if [ -f "$pidfile" ] && kill -0 "$(cat $pidfile)" 2>/dev/null; then + kill "$(cat $pidfile)" + rm -f "$pidfile" + echo "$name stopped." + else + echo "$name is not running." + fi +} + +operator_panel_status() { + if [ -f "$pidfile" ] && kill -0 "$(cat $pidfile)" 2>/dev/null; then + echo "$name is running with PID $(cat $pidfile)." + else + echo "$name is not running." + fi +} + +run_rc_command "$1" diff --git a/app/system/resources/service/freebsd.service b/app/system/resources/service/freebsd.service new file mode 100644 index 000000000..8695bb436 --- /dev/null +++ b/app/system/resources/service/freebsd.service @@ -0,0 +1,65 @@ +#!/bin/sh +# +# PROVIDE: system_status +# REQUIRE: DAEMON +# KEYWORD: shutdown +# +# Add the following lines to /etc/rc.conf to enable system_status: +# system_status_enable: Set it to "YES" to enable system_status. +# Default is "NO". +# + +. /etc/rc.subr +name="system_status" + +rcvar=${name}_enable +load_rc_config $name + +# Set defaults +: ${system_status_enable="NO"} +: ${system_status_pidfile="/var/run/system_status.pid"} + +# Prepare the variables +start_cmd=${name}_start +stop_cmd=${name}_stop +status_cmd=${name}_status +pidfile=${system_status_pidfile} + +# Path to the PHP script +script="/usr/local/www/fusionpbx/app/system_status/resources/service/system_status.php" + +# Command to run the script +command="/usr/local/bin/php" +command_args="$script > /dev/null 2>&1" + +system_status_start() { + echo "Starting $name..." + if [ -f "$pidfile" ] && kill -0 "$(cat $pidfile)" 2>/dev/null; then + echo "$name is already running." + else + $command $command_args & + echo $! > "$pidfile" + echo "$name started." + fi +} + +system_status_stop() { + echo "Stopping $name..." + if [ -f "$pidfile" ] && kill -0 "$(cat $pidfile)" 2>/dev/null; then + kill "$(cat $pidfile)" + rm -f "$pidfile" + echo "$name stopped." + else + echo "$name is not running." + fi +} + +system_status_status() { + if [ -f "$pidfile" ] && kill -0 "$(cat $pidfile)" 2>/dev/null; then + echo "$name is running with PID $(cat $pidfile)." + else + echo "$name is not running." + fi +} + +run_rc_command "$1" diff --git a/app/xml_cdr/resources/service/freebsd.service b/app/xml_cdr/resources/service/freebsd.service new file mode 100644 index 000000000..6913fafd4 --- /dev/null +++ b/app/xml_cdr/resources/service/freebsd.service @@ -0,0 +1,65 @@ +#!/bin/sh +# +# PROVIDE: xml_cdr +# REQUIRE: DAEMON +# KEYWORD: shutdown +# +# Add the following lines to /etc/rc.conf to enable xml_cdr: +# xml_cdr_enable: Set it to "YES" to enable xml_cdr. +# Default is "NO". +# + +. /etc/rc.subr +name="xml_cdr" + +rcvar=${name}_enable +load_rc_config $name + +# Set defaults +: ${xml_cdr_enable="NO"} +: ${xml_cdr_pidfile="/var/run/xml_cdr.pid"} + +# Prepare the variables +start_cmd=${name}_start +stop_cmd=${name}_stop +status_cmd=${name}_status +pidfile=${xml_cdr_pidfile} + +# Path to the PHP script +script="/usr/local/www/fusionpbx/app/xml_cdr/resources/service/xml_cdr.php" + +# Command to run the script +command="/usr/local/bin/php" +command_args="$script > /dev/null 2>&1" + +xml_cdr_start() { + echo "Starting $name..." + if [ -f "$pidfile" ] && kill -0 "$(cat $pidfile)" 2>/dev/null; then + echo "$name is already running." + else + $command $command_args & + echo $! > "$pidfile" + echo "$name started." + fi +} + +xml_cdr_stop() { + echo "Stopping $name..." + if [ -f "$pidfile" ] && kill -0 "$(cat $pidfile)" 2>/dev/null; then + kill "$(cat $pidfile)" + rm -f "$pidfile" + echo "$name stopped." + else + echo "$name is not running." + fi +} + +xml_cdr_status() { + if [ -f "$pidfile" ] && kill -0 "$(cat $pidfile)" 2>/dev/null; then + echo "$name is running with PID $(cat $pidfile)." + else + echo "$name is not running." + fi +} + +run_rc_command "$1" diff --git a/core/websockets/resources/service/freebsd.service b/core/websockets/resources/service/freebsd.service new file mode 100644 index 000000000..54a6caef2 --- /dev/null +++ b/core/websockets/resources/service/freebsd.service @@ -0,0 +1,65 @@ +#!/bin/sh +# +# PROVIDE: websockets +# REQUIRE: DAEMON +# KEYWORD: shutdown +# +# Add the following lines to /etc/rc.conf to enable websockets: +# websockets_enable: Set it to "YES" to enable websockets. +# Default is "NO". +# + +. /etc/rc.subr +name="websockets" + +rcvar=${name}_enable +load_rc_config $name + +# Set defaults +: ${websockets_enable="NO"} +: ${websockets_pidfile="/var/run/websockets.pid"} + +# Prepare the variables +start_cmd=${name}_start +stop_cmd=${name}_stop +status_cmd=${name}_status +pidfile=${websockets_pidfile} + +# Path to the PHP script +script="/usr/local/www/fusionpbx/app/websockets/resources/service/websockets.php" + +# Command to run the script +command="/usr/local/bin/php" +command_args="$script > /dev/null 2>&1" + +websockets_start() { + echo "Starting $name..." + if [ -f "$pidfile" ] && kill -0 "$(cat $pidfile)" 2>/dev/null; then + echo "$name is already running." + else + $command $command_args & + echo $! > "$pidfile" + echo "$name started." + fi +} + +websockets_stop() { + echo "Stopping $name..." + if [ -f "$pidfile" ] && kill -0 "$(cat $pidfile)" 2>/dev/null; then + kill "$(cat $pidfile)" + rm -f "$pidfile" + echo "$name stopped." + else + echo "$name is not running." + fi +} + +websockets_status() { + if [ -f "$pidfile" ] && kill -0 "$(cat $pidfile)" 2>/dev/null; then + echo "$name is running with PID $(cat $pidfile)." + else + echo "$name is not running." + fi +} + +run_rc_command "$1"