update scriptes

This commit is contained in:
Zhang Peng 2019-07-11 16:52:03 +08:00
parent b617a8f272
commit 7e0a81e13f
8 changed files with 82 additions and 12 deletions

View File

@ -0,0 +1,33 @@
#!/usr/bin/env bash
###################################################################################
# 控制台颜色
BLACK="\033[1;30m"
RED="\033[1;31m"
GREEN="\033[1;32m"
YELLOW="\033[1;33m"
BLUE="\033[1;34m"
PURPLE="\033[1;35m"
CYAN="\033[1;36m"
RESET="$(tput sgr0)"
###################################################################################
printf "${BLUE}"
cat << EOF
###################################################################################
# 安装 Jenkins 脚本
# 适用于所有 linux 发行版本。
# @author: Zhang Peng
###################################################################################
EOF
printf "${RESET}"
printf "${BLUE}>>>>>>>> install jenkins\n${RESET}"
# 下载并解压 jenkins
mkdir -p /opt/jenkins
wget -O /opt/jenkins/jenkins.war http://mirrors.jenkins.io/war-stable/latest/jenkins.war
printf "${GREEN}<<<<<<<< install jenkins\n${RESET}"

View File

@ -1,5 +1,18 @@
#!/usr/bin/env bash #!/usr/bin/env bash
###################################################################################
# 控制台颜色
BLACK="\033[1;30m"
RED="\033[1;31m"
GREEN="\033[1;32m"
YELLOW="\033[1;33m"
BLUE="\033[1;34m"
PURPLE="\033[1;35m"
CYAN="\033[1;36m"
RESET="$(tput sgr0)"
###################################################################################
printf "${BLUE}"
cat << EOF cat << EOF
################################################################################### ###################################################################################
@ -10,11 +23,17 @@ cat << EOF
################################################################################### ###################################################################################
EOF EOF
printf "${RESET}"
command -v yum >/dev/null 2>&1 || { echo >&2 "Require yum but it's not installed. Aborting."; exit 1; } printf "${BLUE}>>>>>>>> install jdk8\n${RESET}"
echo -e "\n>>>>>>>>> install jdk8" command -v yum >/dev/null 2>&1 || {
printf "${RED}Require yum but it's not installed. Aborting.\n${RESET}"
echo >&2 "Require yum but it's not installed. Aborting.";
exit 1;
}
yum -y install java-1.8.0-openjdk.x86_64
yum -y install java-1.8.0-openjdk-devel.x86_64 yum -y install java-1.8.0-openjdk-devel.x86_64
java -version java -version
printf "${GREEN}<<<<<<<< install jdk8 finished\n${RESET}"

View File

@ -0,0 +1,6 @@
#!/usr/bin/env bash
wget https://dev.mysql.com/get/mysql80-community-release-el7-3.noarch.rpm
sudo rpm -Uvh mysql80-community-release-el7-3.noarch.rpm
sudo yum install mysql-community-server

View File

@ -32,9 +32,9 @@ if [[ -n $3 ]]; then
port=$3 port=$3
fi fi
password=123456 password=
if [[ -n $4 ]]; then if [[ -n $4 ]]; then
path=$4 password=$4
fi fi
echo "Current execution: install redis ${version} to ${root}, service port = ${port}, password = ${password}" echo "Current execution: install redis ${version} to ${root}, service port = ${port}, password = ${password}"

View File

@ -21,7 +21,8 @@ wget https://github.com/robbyrussell/oh-my-zsh/raw/master/tools/install.sh -O -
# 替换 oh-my-zsh 主题 # 替换 oh-my-zsh 主题
sed -i "s#^ZSH_THEME=.*#ZSH_THEME=\"ys\"#g" ~/.zshrc sed -i "s#^ZSH_THEME=.*#ZSH_THEME=\"ys\"#g" ~/.zshrc
# 下载 incr.zsh 补全插件 # 下载 incr.zsh 补全插件
wget http://mimosa-pudica.net/src/incr-0.2.zsh wget http://mimosa-pudica.net/src/incr-0.2cd.zsh
mkdir ~/.oh-my-zsh/plugins/incr/
mv incr-0.2.zsh ~/.oh-my-zsh/plugins/incr/ mv incr-0.2.zsh ~/.oh-my-zsh/plugins/incr/
echo "source ~/.oh-my-zsh/plugins/incr/incr*.zsh" >> ~/.zshrc echo "source ~/.oh-my-zsh/plugins/incr/incr*.zsh" >> ~/.zshrc

View File

@ -242,15 +242,14 @@ EOF
# 获取CPU/内存占用TOP10 # 获取CPU/内存占用TOP10
get_process_top_info() { get_process_top_info() {
top_title=$(top -b n1|head -7|tail -1) top_title=$(top -b n1 | head -7 | tail -1)
cpu_top10=$(top b -n1 | head -17 | tail -11) cpu_top10=$(top -b n1 | head -17 | tail -11)
mem_top10=$(top -b n1|head -17|tail -10|sort -k10 -r) mem_top10=$(top -b n1 | head -17 | tail -10 | sort -k10 -r)
cat << EOF cat << EOF
【TOP10】 【TOP10】
CPU占用TOP10: CPU占用TOP10:
${top_title}
${cpu_top10} ${cpu_top10}
内存占用TOP10: 内存占用TOP10:

View File

@ -0,0 +1,12 @@
#!/usr/bin/env bash
user='root'
password='xxxxxx'
database='test'
for f in `ls */*.sql`
do
echo ${f};
mysql -u${user} -p${password} -f ${database} -e "source $f";
done
echo 'OK!'

View File

@ -1,5 +1,5 @@
#!/usr/bin/env bash #!/usr/bin/env bash
cd .. cd ..
git push origin master git push github master
git push second master git push gitee master