欢迎来到天天文库
浏览记录
ID:8806411
大小:30.00 KB
页数:4页
时间:2018-04-08
《shell脚本自动安装mysql-5.5.30》由会员上传分享,免费在线阅读,更多相关内容在应用文档-天天文库。
1、shell脚本自动安装mysql-5.5.30cmake编译#!/bin/bash##automaticconfiguremysqlfromsourcecodesincemysql5.5#editbyfrankhwang#e-mailMyDBA2006@gmail.com#version1.0#2013/03/25##checkoutlockfilewhetherornotexistlockfile=/tmp/$(basename$0)_lockfileif[-f$lockfile];thenpid=$(cat$lockfile)ps-p$pid
2、grep$pid&>/de
3、v/nullif[$?==0];thenecho"thescriptisalreadyrunning!!!"&&exit16elseecho$$>$lockfilefielseecho$$>$lockfilefiechoecho"***step1:checkwhethermysqlisalreadyinstalled?"echoforiinmysqlmysql-servermysql-testmysql-benchmysql-connector-javamysql-connector-odbcmysql-develdorpm-q$i&>/dev/nullif[$?==0];
4、thenrpm-e$i--nodeps&>/dev/nullecho$i"wasuninstalled"fidoneechoecho"***step2:installpackages"echoyumlist
5、grepmysql-server&>/dev/nullif[$?==0];thenecho"YUMinstallationsourcesareready..."elseecho"YUMinstallationsourcesarenotFOUND!!!"echo"pleasecheckit!!!"fiyum-yinstallgccgcc-c++flexbisonautoc
6、onfautomakecmakencurses-develcurl-develmakelynx&>/dev/nullechoecho"***step3:configureinstallationvariablesformysql"echoread-p"pleaseinputmysql_dir(/usr/local/mysql-VERSION):"mysql_dirif[-d$mysql_dir];thenecho$mysql_dirisexist,OK!elseecho$mysql_dirisnotexistread-p"makeit?(yes/NO):"answer[-z
7、$answer]&&answer=noif[$answer=="yes"-o$answer=="y"];thenmkdir$mysql_dir&&echo$mysql_dirisOK!elseexit11;fifiread-p"pleaseinputmysql_data_dir(/mysql/data):"mysql_data_dirif[-d$mysql_data_dir];thenecho$mysql_data_dirisexist,OK!elseecho$mysql_data_dirisnotexistread-p"makeit?(yes/NO):"answer[-z
8、$answer]&&answer=noif[$answer=="yes"-o$answer=="y"];thenmkdir$mysql_data_dir&&echo$mysql_data_dirisOK!elseexit12;fifiread-p"pleaseinputmysql_conf_dir(/mysql/conf):"mysql_conf_dirif[-d$mysql_conf_dir];thenecho$mysql_conf_dirisexist,OK!elseecho$mysql_conf_dirisnotexistread-p"makeit?(yes/NO):
9、"answer[-z$answer]&&answer=noif[$answer=="yes"-o$answer=="y"];thenmkdir$mysql_conf_dir&&echo$mysql_conf_dirisOK!elseexit13;fifiechoecho$mysql_direcho$mysql_data_direcho$mysql_conf_dirread-p"pleaseconfirmagain,thesevariablesarecorrectly?(yes/NO):"answer[-z$answ
此文档下载收益归作者所有