If you are looking for a template to write a fast copy-and-paste script (daemonized) for monitoring one process… you can get some ideas from this: