Skip to content

Instantly share code, notes, and snippets.

@sqqqrly
Last active April 1, 2020 21:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sqqqrly/0cd3b29a99bd7bfe4c39767382d6415f to your computer and use it in GitHub Desktop.
Save sqqqrly/0cd3b29a99bd7bfe4c39767382d6415f to your computer and use it in GitHub Desktop.
Trapping signals / awk, without leaning toothpicks
#!/bin/bash
function shutdown {
echo "Shutting down $PROGRAM"
local -r QUIT="SIGQUIT"
# TODO - What is the process is not found?
local -r PID="$(ps aux | awk '( $0 ~ "/usr/bin/clickhouse-server" ) {print $2}')"
echo "pid: $PID"
#kill -s 3 "$PID"
echo "Done killing"
}
trap shutdown EXIT
echo "sleeping..."
sleep 3600
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment