#!/bin/bash status=$(ps aux | grep httpd | grep -v grep) if [ -n "$status" ] then echo "$(date) http is ok" else echo "$(date) http is down" /etc/rc.d/init.d/httpd start fi
找到原因了,脚本名称不能含有httpd