Sindbad~EG File Manager

Current Path : /opt/nginxhttpd_/bin/
Upload File :
Current File : //opt/nginxhttpd_/bin/postSslHook.sh

#!/bin/bash

set -euo pipefail
IFS=$'\n\t'
export LC_ALL=C

if test "$#" -eq 1 && test "$1" == '--describe' ; then
  echo '{"category":"Cpanel","escalateprivs":1,"event":"UAPI::SSL::install_ssl","stage":"post","hook":"\/opt\/nginxhttpd\/bin\/postSslHook.sh","exectype":"script"}'
  exit 0
fi

DATA=$(</dev/stdin)

echo "$DATA" | grep -qi -e 'An error' -e 'result":0' && (echo "1 Ignored. The API response seems to contain an error." && exit 0)

DOMAIN=$(echo "$DATA" | grep -Eo 'servername":"[a-zA-Z0-9.-]+"' | cut -d '"' -f 3 | tr -d '\n')

test "$DOMAIN" == "" && (echo "0 Cant extract the domain from the API event data" && exit 1)

/usr/bin/timeout 20 /usr/local/bin/php /opt/nginxhttpd/bin/console openresty:generate --domain="$DOMAIN" >/dev/null 2>&1 &

echo "1 Openresty refreshed for $DOMAIN"
exit 0

Sindbad File Manager Version 1.0, Coded By Sindbad EG ~ The Terrorists