1. 脚本文件: vim /home/lee/test.sh
#!/bin/bash
if [ "`pgrep test | wc -l`" == "0" ]; then
	echo "`date '+%F %T'`:[test]停止运行" >> /var/log/crontab/crontab.log
	systemctl restart test
fi
  1. crontab配置: crontab -e
 * * * * *  .  /home/lee/test.sh