Unverified Commit ea3c9c8b authored by Kroese's avatar Kroese Committed by GitHub
Browse files

Trap

parent 73d983c7
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -6,11 +6,13 @@ script_name=${BASH_SOURCE[0]}

for pid in $(pidof -x $script_name); do
  if [ $pid != $$ ]; then
    kill -9 $pid 2> /dev/null
    kill -15 $pid 2> /dev/null
    wait $pid 2> /dev/null
  fi 
done

trap exit SIGINT SIGTERM

# Serve the page
HTML="<HTML><BODY><H1><CENTER>$2</CENTER></H1></BODY></HTML>"
RESPONSE="HTTP/1.1 200 OK\r\nConnection: close\r\n\r\n$HTML\r\n"