There is no option to run a script during/after a service restart in Cloudera Manager. A possible alternative way may be to poll the service status using CM API in your script, then act on changes.
Just out of interest, what is this script supposed to do?