HEX
Server: Apache
System: Linux hz.vslconceptsdomains.com 5.4.0-216-generic #236-Ubuntu SMP Fri Apr 11 19:53:21 UTC 2025 x86_64
User: dkfounda (3233)
PHP: 8.1.34
Disabled: exec,passthru,shell_exec,system
Upload Files
File: //usr/local/mailchannels/bin/lib/run_fatal.sh
#!/usr/bin/env bash
#run the given command and fail with an error message if it doesn't run successfully. The second parameter is the optional
#error message, but a default message is printed if the error message isn't provided

CMD=$1

if [[ -z ${CMD} ]]; then
    echo "You must provide a command to run."
    exit 1
fi

ERROR_MESSAGE=$2
if [[ -z ${ERROR_MESSAGE} ]]; then
    ERROR_MESSAGE="Failed to run command ${CMD}, Aborting."
fi

${CMD}

if [[ $? != 0 ]]; then
    echo ${ERROR_MESSAGE}
    exit 1
fi