This commit is contained in:
2026-04-09 14:47:35 +08:00
parent f6eb48fc91
commit 431dd2ab36
23 changed files with 313 additions and 25 deletions

51
php/ADD-7.2/ccmd Executable file
View File

@@ -0,0 +1,51 @@
#!/bin/bash
##################################################
# Mount dir #
# - /var/log/php7 #
##################################################
set -euo pipefail
export LANG=en_US.UTF-8
trap Quit EXIT
PIDS=
GOT_SIGTERM=
function Print {
local file=/dev/null
[ '-f' = "$1" ] && file=$2 && shift && shift
date +"[%F %T] $*" | tee -a $file
}
function Quit {
Print killing php ...
while :; do
pkill -f php-fpm7 && Print killing php-fpm7 ... || break
sleep 2
done
Print Container stopped.
test -n "$GOT_SIGTERM"
}
function StartProc {
Print Start php ...
php-fpm7 -F -y /etc/php7/php-fpm.conf &
PIDS="$PIDS $!"
Print PHP started.
}
function Main {
local pid=
StartProc
trap "GOT_SIGTERM=1; Print Got SIGTERM ..." SIGTERM
while [ -z "$GOT_SIGTERM" ] && sleep 2; do
for pid in $PIDS; do
[ ! -e /proc/$pid ] && Print Unexpected error! && exit
done
done
}
# Start here
Main