diff --git a/codes/linux/soft/docker-install.sh b/codes/linux/soft/docker-install.sh new file mode 100644 index 0000000..515f770 --- /dev/null +++ b/codes/linux/soft/docker-install.sh @@ -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}" diff --git a/codes/linux/soft/jdk8-install.sh b/codes/linux/soft/jdk8-install.sh index 1a60024..71651df 100644 --- a/codes/linux/soft/jdk8-install.sh +++ b/codes/linux/soft/jdk8-install.sh @@ -1,5 +1,18 @@ #!/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 ################################################################################### @@ -10,11 +23,17 @@ cat << 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 java -version + +printf "${GREEN}<<<<<<<< install jdk8 finished\n${RESET}" diff --git a/codes/linux/soft/mysql-install.sh b/codes/linux/soft/mysql-install.sh new file mode 100644 index 0000000..7f99107 --- /dev/null +++ b/codes/linux/soft/mysql-install.sh @@ -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 diff --git a/codes/linux/soft/redis-install.sh b/codes/linux/soft/redis-install.sh index f153ec6..7fe261f 100644 --- a/codes/linux/soft/redis-install.sh +++ b/codes/linux/soft/redis-install.sh @@ -32,9 +32,9 @@ if [[ -n $3 ]]; then port=$3 fi -password=123456 +password= if [[ -n $4 ]]; then - path=$4 + password=$4 fi echo "Current execution: install redis ${version} to ${root}, service port = ${port}, password = ${password}" diff --git a/codes/linux/soft/zsh-install.sh b/codes/linux/soft/zsh-install.sh index 5892950..f115004 100644 --- a/codes/linux/soft/zsh-install.sh +++ b/codes/linux/soft/zsh-install.sh @@ -21,7 +21,8 @@ wget https://github.com/robbyrussell/oh-my-zsh/raw/master/tools/install.sh -O - # 替换 oh-my-zsh 主题 sed -i "s#^ZSH_THEME=.*#ZSH_THEME=\"ys\"#g" ~/.zshrc # 下载 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/ echo "source ~/.oh-my-zsh/plugins/incr/incr*.zsh" >> ~/.zshrc diff --git a/codes/linux/tool/syscheck b/codes/linux/sys/syscheck similarity index 98% rename from codes/linux/tool/syscheck rename to codes/linux/sys/syscheck index fad6131..6ced585 100644 --- a/codes/linux/tool/syscheck +++ b/codes/linux/sys/syscheck @@ -242,15 +242,14 @@ EOF # 获取CPU/内存占用TOP10 get_process_top_info() { - top_title=$(top -b n1|head -7|tail -1) - cpu_top10=$(top b -n1 | head -17 | tail -11) - mem_top10=$(top -b n1|head -17|tail -10|sort -k10 -r) + top_title=$(top -b n1 | head -7 | tail -1) + cpu_top10=$(top -b n1 | head -17 | tail -11) + mem_top10=$(top -b n1 | head -17 | tail -10 | sort -k10 -r) cat << EOF 【TOP10】 CPU占用TOP10: -${top_title} ${cpu_top10} 内存占用TOP10: diff --git a/codes/shell/示例脚本/mysql/SQL批处理执行脚本.sh b/codes/shell/示例脚本/mysql/SQL批处理执行脚本.sh new file mode 100644 index 0000000..e74299d --- /dev/null +++ b/codes/shell/示例脚本/mysql/SQL批处理执行脚本.sh @@ -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!' diff --git a/scripts/gitpush.sh b/scripts/gitpush.sh index ac58b52..ec14d5a 100644 --- a/scripts/gitpush.sh +++ b/scripts/gitpush.sh @@ -1,5 +1,5 @@ #!/usr/bin/env bash cd .. -git push origin master -git push second master +git push github master +git push gitee master