编写Shell程序,实现OpenStack基础服务MySQL、NTP、ETCD服务运行判断。
时间: 2024-05-24 14:12:10 浏览: 139
#!/bin/bash
# check_openstack_services.sh
# Check MySQL service status
echo "Checking MySQL service status..."
if systemctl status mariadb.service | grep "active (running)"; then
echo "MySQL service is running."
else
echo "MySQL service is not running."
fi
# Check NTP service status
echo "Checking NTP service status..."
if systemctl status ntpd.service | grep "active (running)"; then
echo "NTP service is running."
else
echo "NTP service is not running."
fi
# Check ETCD service status
echo "Checking ETCD service status..."
if systemctl status etcd.service | grep "active (running)"; then
echo "ETCD service is running."
else
echo "ETCD service is not running."
fi
echo "Service status check completed."
阅读全文