HEX
Server:
System: Linux aac286ea486c 5.14.0-687.15.1.el9_8.x86_64 #1 SMP PREEMPT_DYNAMIC Thu Jun 11 08:51:45 EDT 2026 x86_64
User: root (0)
PHP: 8.2.30
Disabled: pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,disk_free_space,diskfreespace
Upload Files
File: //usr/local/bin/run-userini-parser.sh
#!/bin/bash

#
# This script runs the userini-parser and compares the parsed configs with the existing ones
#

set -eu

PARSER="/usr/local/bin/userini-parser"
USER_INI_FILE_NAME=".user.ini"

# check if USER_INI_OUTPUT_DIR is set
if [[ -z "${USER_INI_OUTPUT_DIR:-}" ]]; then
    echo "USER_INI_OUTPUT_DIR is not set"
    exit 1
fi

USER_INI_FILE="${USER_INI_OUTPUT_DIR}/${USER_INI_FILE_NAME}"
USER_INI_FILE_BAK="${USER_INI_OUTPUT_DIR}/${USER_INI_FILE_NAME}.bak"

# look for existing parsed configs if any, and backup
if [[ -f $USER_INI_FILE ]]; then
    mv -f $USER_INI_FILE $USER_INI_FILE_BAK
fi

# run the parser
if [[ -x ${PARSER} ]]; then
    echo "Running ${PARSER}"
    ${PARSER}
else
    echo "${PARSER} does not exist or is not executable"
    exit 2
fi

# compare the parsed configs with the existing ones
if [[ -f $USER_INI_FILE ]]; then
    if [[ -f $USER_INI_FILE_BAK ]]; then
        if cmp -s "$USER_INI_FILE" "$USER_INI_FILE_BAK"; then
            echo "The files ${USER_INI_FILE} and ${USER_INI_FILE_BAK} match"
            rm -f $USER_INI_FILE_BAK
            exit 4
        else
            echo "The files ${USER_INI_FILE} and ${USER_INI_FILE_BAK} are different"
            # Reload PHP-FPM to pick up the new configuration
            if [[ -f /alloc/tmp/php-fpm.pid ]]; then
                echo "Reloading PHP-FPM configuration..."
                kill -SIGUSR2 $(cat /alloc/tmp/php-fpm.pid)
                echo "PHP-FPM reload signal sent"
            else
                echo "Warning: /alloc/tmp/php-fpm.pid not found, cannot reload PHP-FPM"
            fi
        fi
        rm -f $USER_INI_FILE_BAK
    else
        echo "The backup file does not exist"
    fi
else
    echo "The parsed file does not exist"
fi

exit 0