![](https://img-blog.csdnimg.cn/20201014180756922.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
shell
墙角一直霉
这个作者很懒,什么都没留下…
展开
-
shell部署tomcat
#Tomcat根目录TOMCAT_HOME="/usr/local/tomcat/apache-tomcat-9.0.0.M4"#端口TOMCAT_PORT=8080#TOMCAT_PID用于检测Tomcat是否在运行TOMCAT_PID=`lsof -n -P -t -i :${TOMCAT_PORT}`#如果Tomcat还在运行if [ -n "${TOMCAT_PID}" ]原创 2018-01-25 16:14:53 · 613 阅读 · 0 评论 -
shell颜色输出
shell脚本中echo显示内容带颜色显示,echo显示带颜色,需要使用参数-e 格式如下: echo -e "\033[字背景颜色;文字颜色m字符串\033[0m" 例如: echo -e "\033[41;36m something here \033[0m" 其中41的位置代表底色, 36的位置是代表字的颜色 注: 1、字背景颜色和文字颜色之间是英文的"" 2、...原创 2019-02-11 10:52:55 · 3393 阅读 · 0 评论 -
kubernetes初始化环境脚本
#!/bin/bash#查看系统及内核版本cat /etc/redhat-releaserelease=`cat /etc/redhat-release|sed -r 's/.* ([0-9]+)\..*/\1/'`system=`cat /etc/redhat-release|awk '{print $1}'`if [ "$release" == 7 ] && [ "...原创 2019-01-10 16:50:26 · 475 阅读 · 0 评论 -
linux批量部署GIT
TOMCAT #!/bin/bashset -uset -epath=/data/trade/testweb/function tomcat() { for i in `cd $path && echo tomcat*`doecho $idone}tomcat=`tomcat` function a() { for...原创 2018-12-04 10:16:16 · 171 阅读 · 0 评论 -
linux计算脚本执行时间
#/bin/bashfunction handle(){start=$(date +%s%N)start_ms=${start:0:16}#awk '{a[$1]++} END{print length(a)}' breakfast_all receptions_all cheap_alltar -c --lzma -f local.tar.lzma trade_01_2018-08...原创 2018-12-04 10:11:10 · 1351 阅读 · 0 评论 -
ubuntu LNMP环境脚本
#!/bin/bashset -e#更新ubuntu源apt-get update -yred='\33[5m\033[31m'green='\033[32m'#开启防火墙#ufw=`ufw status|awk '{print $2}'`#if [ $ufw == inactive ]; then# echo y | ufw enable# ufw defaul...原创 2018-08-13 09:38:08 · 170 阅读 · 0 评论 -
ORACLE环境初始化脚本
#!/bin/bash#Date 20160217#Version 1.2#普通Linux服务器 /root目录下执行此脚本,执行之前修改用户的密码 HTOPS_PWD=trade #1.关闭iptablesiptables -Fservice iptables saveservice iptables restartchkconfig iptables...原创 2018-08-13 09:35:48 · 588 阅读 · 0 评论 -
ES删除索引
# ES删除索引API例:删除所有为logstash的索引[官方说明](https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-delete-index.html)```shellcurl -XDELETE 'http://host.IP.address:9200/logstash-*' ```# ES查...原创 2018-05-23 20:09:50 · 33479 阅读 · 0 评论 -
shell服务器基础环境搭建
#!/bin/bashset -e#更新ubuntu源apt-get update -yred='\33[5m\033[31m'green='\033[32m'#开启防火墙ufw=`ufw status|awk '{print $2}'`if [ $ufw == inactive ]; then echo y | ufw enable ufw default deny incoming ufw d...原创 2018-05-25 18:56:28 · 682 阅读 · 0 评论 -
批量查询数据库内容
#/bin/bashname=`cat 2.txt`for i in $namedo sqlplus -S mintrade/HTCH2017htch << EOF set heading off feedback off verify off SELECT f_sign_account FROM TRADE.T_F_B_DEALER_BAN...原创 2018-05-25 18:54:29 · 2364 阅读 · 0 评论 -
shell执行数组变量
#!/bin/bashIFS=' 'web=($1)for i in ${web[@]}do cd /data/trade/www/tomcat_$i/webapps/$i/ && git init && git add . && git commit -m '1' #cd /data/trade/www/tomcat_$...原创 2018-05-25 18:53:59 · 963 阅读 · 0 评论 -
限制ssh远程登陆
超过十次,就添加到hosts.deny里面去#!/bin/bashdate=`date +%Y%m%d`file="/var/log/secure"max=10if [[ -f $file ]]then grep Failed $file | awk '{print $(NF-3)}' | sort -rn | uniq -c | awk '{print $2 "="...原创 2018-05-25 18:53:25 · 497 阅读 · 0 评论 -
Shell实现等待用户输入并设定缺省执行
while true;dostty -icanon min 0 time 100echo -n "Automatic execute ten seconds after,Are you sure you want to start the task(yes or no)?"read Argcase $Arg inY|y|YES|yes) break;;N|n|NO|no)...原创 2019-02-11 10:53:30 · 8952 阅读 · 0 评论