Fully detach from parent shell to prevent 'service' from blocking

This commit is contained in:
FusionPBX
2026-05-12 06:40:25 +00:00
committed by GitHub
parent ed241110ab
commit fa5ae89827
9 changed files with 18 additions and 18 deletions
@@ -30,14 +30,14 @@ script="/usr/local/www/fusionpbx/app/active_calls/resources/service/active_calls
# 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 &
# Fully detach from parent shell to prevent 'service' from blocking
nohup $command $script </dev/null >/dev/null 2>&1 &
echo $! > "$pidfile"
echo "$name started."
fi
@@ -30,14 +30,14 @@ script="/usr/local/www/fusionpbx/app/active_conferences/resources/service/active
# 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 &
# Fully detach from parent shell to prevent 'service' from blocking
nohup $command $script </dev/null >/dev/null 2>&1 &
echo $! > "$pidfile"
echo "$name started."
fi
@@ -30,14 +30,14 @@ script="/usr/local/www/fusionpbx/app/email_queue/resources/service/email_queue.p
# 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 &
# Fully detach from parent shell to prevent 'service' from blocking
nohup $command $script </dev/null >/dev/null 2>&1 &
echo $! > "$pidfile"
echo "$name started."
fi
@@ -30,14 +30,14 @@ script="/usr/local/www/fusionpbx/app/event_guard/resources/service/event_guard.p
# 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 &
# Fully detach from parent shell to prevent 'service' from blocking
nohup $command $script </dev/null >/dev/null 2>&1 &
echo $! > "$pidfile"
echo "$name started."
fi
@@ -30,14 +30,14 @@ 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 &
# Fully detach from parent shell to prevent 'service' from blocking
nohup $command $script </dev/null >/dev/null 2>&1 &
echo $! > "$pidfile"
echo "$name started."
fi
@@ -30,14 +30,14 @@ script="/usr/local/www/fusionpbx/app/operator_panel/resources/service/operator_p
# 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 &
# Fully detach from parent shell to prevent 'service' from blocking
nohup $command $script </dev/null >/dev/null 2>&1 &
echo $! > "$pidfile"
echo "$name started."
fi
+2 -2
View File
@@ -30,14 +30,14 @@ script="/usr/local/www/fusionpbx/app/system/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 &
# Fully detach from parent shell to prevent 'service' from blocking
nohup $command $script </dev/null >/dev/null 2>&1 &
echo $! > "$pidfile"
echo "$name started."
fi
@@ -30,14 +30,14 @@ 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 &
# Fully detach from parent shell to prevent 'service' from blocking
nohup $command $script </dev/null >/dev/null 2>&1 &
echo $! > "$pidfile"
echo "$name started."
fi
@@ -30,14 +30,14 @@ 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 &
# Fully detach from parent shell to prevent 'service' from blocking
nohup $command $script </dev/null >/dev/null 2>&1 &
echo $! > "$pidfile"
echo "$name started."
fi