monitor mysql status

monitor mysql status

我想监控mysql的运行状态(started stop),如是stop就发email给我并重启mysql服务,请各位指教      
给点儿思路:
复制内容到剪贴板
代码:
while true; do
  sleep 1
  if ! pidof some_cmd; then
    # what do u want to do?
  fi
done