很期待,学习shell脚本,减少重复工作 自动安装配置mysql脚本: #/bin/bash LOG_FILE=/home/hadoop1/log/installmysql.log function RpmMysql(){ key=$1 r=$(rpm -qa $key) if [ $r ]; then return 1 else return 0 fi } mysql="mysql-server" RpmMysql mysql r=$? if [ $r -eq 1 ] ; then
核心代码 #!/bin/sh myPath="/var/log/httpd/" myFile="/var /log/httpd/access.log" #这里的-x 参数判断$myPath是否存在并且是否具有可执行权限 if [ ! -x "$myPath"]; then mkdir "$myPath" fi #这里的-d 参数判断$myPath是否存在 if [ ! -d "$myPath"]; then
解读show slave status 命令判断MySQL复制同步状态 1. show slave status命令可以显示主从同步的状态 MySQL> show slave status \G; *************************** 1. row *************************** Slave_IO_State: Waiting for master to send event Master_Host: 127.0.0.1 Master_User: rep