Last active
March 21, 2019 03:39
-
-
Save zwxbest/e24e9cd379935fad226be56ecef8fdf0 to your computer and use it in GitHub Desktop.
shell脚本
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| rm -rf react-test1 | |
| git clone [email protected]:zwxbest/react-test1.git | |
| cd react-test1 | |
| rm -f ../README.md | |
| touch ../README.md | |
| for line in `git branch -r` | |
| do | |
| branch=${line#*/} | |
| if [[ $branch =~ ^[0-9].* ]] | |
| then | |
| git checkout $branch | |
| echo -e '\n\n## '$branch'\n' | cat - README.md >> ../README.md | |
| fi | |
| done |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| # 不存在则建立 | |
| set -x | |
| rm -rf test/ | |
| testName=test | |
| test -e ${testName} && echo "${testName} exist" || mkdir test | |
| for dir in * | |
| do | |
| if test -d $dir/src/test | |
| then | |
| path=$dir/src/test | |
| echo ${path} | |
| prefix=${path%%/*} | |
| sub=${testName}/${prefix} | |
| test -e ${sub} && echo "${sub} exist" || mkdir ${sub} | |
| cp -r ${path}/* ${sub} | |
| fi | |
| done | |
| tar czvf test.tar test | |
| ~ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| set -x | |
| for file in ./* | |
| do | |
| if test -d $file | |
| then | |
| rm -rf $file/target | |
| fi | |
| done |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/sh | |
| for i in `seq 3`;do | |
| echo "-------------------------prd-$i-----grep $1--------------------------------" | |
| ssh [email protected]$i grep $1 /home/admin/logs/$2 | |
| done |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| # 清理端口占用 | |
| kill -9 $(netstat -nlp | grep :$1| awk '{print $7}' | awk -F"/" '{ print $1 }') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| port=`netstat -ano|findstr 1111` | |
| if test "${port}" = "" | |
| then | |
| echo "starting eureka-server" | |
| cd eureka-server; | |
| mvn spring-boot:run | |
| else | |
| echo "eureka-server maybe already started" | |
| fi | |
| # 本来想直接通过脚本启动,试了一下,关闭挺麻烦的,没有idea直接管理方便。 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment