2025-08-16 00:47:14 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
2025-08-18 05:01:37 +00:00
|
|
|
function p_invoke() {
|
|
|
|
|
perf record -F1000 --call-graph dwarf -o /perf.data \
|
|
|
|
|
-- /nginx/objs/nginx \
|
|
|
|
|
-p /tmp \
|
|
|
|
|
-e /tmp/error.log \
|
|
|
|
|
-c /nginx.conf \
|
|
|
|
|
-g "daemon off;"
|
|
|
|
|
}
|
|
|
|
|
|
2025-08-16 00:47:14 +00:00
|
|
|
function invoke() {
|
|
|
|
|
/nginx/objs/nginx \
|
|
|
|
|
-p /tmp \
|
|
|
|
|
-e /tmp/error.log \
|
|
|
|
|
-c /nginx.conf \
|
|
|
|
|
-g "daemon off;" \
|
|
|
|
|
$@
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function sigint_handler() {
|
|
|
|
|
echo "sigint received. trigger again to kill."
|
|
|
|
|
invoke -s quit
|
|
|
|
|
trap - INT
|
|
|
|
|
}
|
|
|
|
|
|
2025-08-18 04:00:32 +00:00
|
|
|
function sigcont_handler() {
|
|
|
|
|
echo "sigcont received. reloading nginx."
|
|
|
|
|
invoke -s reload
|
|
|
|
|
}
|
|
|
|
|
|
2025-08-16 00:47:14 +00:00
|
|
|
trap 'sigint_handler' INT
|
2025-08-18 04:00:32 +00:00
|
|
|
trap 'sigcont_handler' CONT
|
2025-08-16 00:47:14 +00:00
|
|
|
|
2025-08-18 05:01:37 +00:00
|
|
|
p_invoke &
|
2025-08-16 00:47:14 +00:00
|
|
|
wait
|
|
|
|
|
echo "NGINX down. waiting until signalled..."
|
|
|
|
|
sleep infinity
|