I was tired of repeating the same old pattern. Send a kill signal. Check with pgrep. Did the process exit? Send a kill -9.
Now all my knowledge has been permanently dumped here:
If you want to kill a process by letting it to exit gracefully, and yet kill it without mercy if it's too slow to exit, that's your new favourite shell script.
You can discuss this on Hacker News as well