41 lines
925 B
Bash
Executable file
41 lines
925 B
Bash
Executable file
#!/bin/bash
|
|
|
|
function p_invoke() {
|
|
valgrind --tool=callgrind \
|
|
--trace-children=yes \
|
|
--callgrind-out-file=/tmp/callgrind.output \
|
|
--cache-sim=yes \
|
|
/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
|