FIX_QUEUE_SERVER_SCRIPT

This commit is contained in:
velz 2025-02-10 08:56:27 +05:30
parent c5d25b70ba
commit da35bfe8b1

View File

@ -1,56 +1,7 @@
!/bin/bash
#!/bin/bash
while true; do
echo "Running job at $(date)"
/usr/bin/php /opt/lampp/htdocs/nhance/public/index.php cli/processjob
!/bin/bash
!/bin/bash
# Read the Job_Queue variable from the temporary file
#!/bin/bash
#!/bin/bash
#!/bin/bash
# Define the root directory for the project and PID file path
#!/bin/bash
# Define paths
# ROOT_DIR=$(dirname "$(realpath "$0")")
# JOB_QUEUE_FILE="$ROOT_DIR/job_queue"
# PID_FILE="$ROOT_DIR/phpqueue.pid"
# # Check if the script is already running
# if [[ -f "$PID_FILE" ]] && kill -0 "$(cat $PID_FILE)" 2>/dev/null; then
# echo "phpqueue.sh is already running. Exiting."
# exit 1
# fi
# # Write the current process ID (PID) to the PID file
# echo $$ > "$PID_FILE"
# # Ensure the PID file is removed on script exit
# trap "rm -f $PID_FILE" EXIT
# # Main loop
# while true; do
# # Check if the Job_Queue file exists
# if [[ ! -f "$JOB_QUEUE_FILE" ]]; then
# echo "Job Queue file not found."
# exit 1
# fi
# # Read the value of Job_Queue from the file
# Job_Queue=$(cat "$JOB_QUEUE_FILE")
# if [[ "$Job_Queue" -eq 1 ]]; then
# /usr/bin/php /opt/lampp/htdocs/nhance/public/index.php cli/processjob
# else
# echo "No job to process."
# fi
# # Sleep for 1 second before the next iteration
# sleep 1
# done
/usr/bin/php /var/www/nhance/zenith/public/index.php cli/processjob
sleep 1 # Optional: Add a sleep to avoid CPU overload
done