nginx-profile-setup/kaproxy/run.sh

42 lines
929 B
Bash
Raw Normal View History

#!/bin/bash
function p_invoke() {
# set trace-children=yes to profile worker processes
valgrind --tool=callgrind \
--trace-children=no \
--callgrind-out-file=/tmp/callgrind.output \
/nginx/objs/nginx \
-p /tmp \
-e /tmp/error.log \
-c /nginx.conf \
-g "daemon off;"
}
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
}
function sigcont_handler() {
echo "sigcont received. reloading nginx."
invoke -s reload
}
trap 'sigint_handler' INT
trap 'sigcont_handler' CONT
p_invoke &
wait
echo "NGINX down. waiting until signalled..."
sleep infinity