测试脚本linux,linux shell测试脚本

#!/bin/sh

#=============================================================#

#

Start_all_system_services.sh

#

#

Modified By Hu Changwen on july 13th 2009

#

#

huchangwen@gmail.com && 1581339****

#

#

D&A Technology Co., Ltd. Guangzhou Technology Support Center #

#

#=============================================================#

#Define the install path of all the services

MYSQL_PATH=/usr/local/mysql

OPENLDAP_PATH=/usr/local/openldap

POSTFIX_PATH=/usr/local/postfix

#=======================================================================#

#Define the mysql start function

mysql_start() {

mysql_start_result=`$MYSQL_PATH/bin/mysql.server start`

sleep 3

mysql_start_result_err=`netstat -nutlp | grep mysqld | grep 3306`

[ -z "$mysql_start_result_err" ] && mysql_error "$mysql_start_result" || echo -e "

[ \033[32;1mOK\033[32;0m ]"

}

#Define the mysql error function

mysql_error() {

echo -e "

[ \033[31;1mNG\033[31;0m ]"

echo "$1"

}

#Define the main mysql start function

mysql() {

echo -ne "Starting Mysql Service..."

mysql_running=`netstat -nutlp | grep mysqld | grep 3306`

[ -z "$mysql_running" ] && mysql_start || mysql_error "Mysql Service is running!"

}

#=============================================================================#

#Openldap Service Start Shell

#Define the openldap service start function

openldap_start() {

openldap_start_result=`$OPENLDAP_PATH/libexec/slapd &`

sleep 3

openldap_start_result_err=`netstat -nutlp | grep slapd | grep 389`

[ -z "$openldap_start_result_err" ] && openldap_error "$openldap_start_result" || echo -e "

[ \033[32;1mOK\033[32;0m ]"

}

openldap_error() {

echo -e "

[ \033[31;1mNG\033[31;0m ]"

echo "$1"

}

openldap() {

echo -ne "Starting Openldap Service..."

openldap_running=`netstat -nutlp | grep slapd | grep 389`

[ -z "$openldap_running" ] && openldap_start || openldap_error "Openldap Service is running!"

}

#============================================================================#

postfix_start() {

postfix_start_result=`$POSTFIX_PATH/usr/sbin/postfix start`

sleep 3

postfix_start_result_err=`netstat -nutlp | grep master | grep 25`

[ -z "$postfix_start_result_err" ] && postfix_error "$postfix_start_result" || echo -e "

[ \033[32;1mOK\033[32;0m ]"

}

postfix_error() {

echo -e "

[ \033[31;1mNG\033[31;0m ]"

echo "$1"

}

postfix() {

echo "Starting Postfix Service..."

postfix_running=`netstat -nutlp | grep master | grep 25`

[ -z "$postfix_running" ] && postfix_start || postfix_error "Postfix Service is running!"

}

#===========================================================================#

#Main shell

mysql

openldap

postfix

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值