fusionpbx-install.sh/freebsd/resources/fusionpbx/rc.d.fax_queue

67 lines
1.5 KiB
Plaintext
Raw Permalink Normal View History

2024-08-27 15:14:36 +02:00
#!/bin/sh
#
# PROVIDE: fax_queue
2024-08-27 15:14:36 +02:00
# 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.
2024-08-27 15:14:36 +02:00
# Default is "NO".
#
. /etc/rc.subr
name="fax_queue"
2024-08-27 15:14:36 +02:00
rcvar=${name}_enable
load_rc_config $name
# Set defaults
: ${fax_queue_enable="NO"}
: ${fax_queue_pidfile="/var/run/fax_queue.pid"}
2024-08-27 15:14:36 +02:00
# Prepare the variables
start_cmd=${name}_start
stop_cmd=${name}_stop
status_cmd=${name}_status
pidfile=${fax_queue_pidfile}
2024-08-27 15:14:36 +02:00
# Path to the PHP script
script="/usr/local/www/fusionpbx/app/fax_queue/resources/service/fax_queue.php"
2024-08-27 15:14:36 +02:00
# Command to run the script
command="/usr/local/bin/php"
command_args="$script > /dev/null 2>&1"
fax_queue_start() {
2024-08-27 15:14:36 +02:00
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() {
2024-08-27 15:14:36 +02:00
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() {
2024-08-27 15:14:36 +02:00
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"