centos7检测一个服务是否正在运行 是否开机启动

例如检测fail2ban
#检测是否在运行
systemctl status fail2ban

#检测是否开机启动
systemctl list-unit-files | grep fail2ban