Add FreeBSD rc.d service files
This commit is contained in:
@@ -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"
|
||||||
@@ -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"
|
||||||
@@ -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"
|
||||||
@@ -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"
|
||||||
@@ -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"
|
||||||
|
|
||||||
@@ -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"
|
||||||
@@ -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"
|
||||||
@@ -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"
|
||||||
@@ -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"
|
||||||
Reference in New Issue
Block a user