How would you witches

suggest to solve the following with a batch script set to run in cron every minute:
- check if NXT client is working nicely (with a get request to one of the API calls)
- parse the output to verify the functioning (would seeing some balance be enough? Probably not, been unable to send payment despite visible balance)
- if output from API is not valid, check if client is running in system
- if running, kill it gracefully and and check until killed
- when not running, start client in the background
Thanks a lot!