说明
基于微服务项目,产生的的多项目仓库管理脚本。可直接保存 shell 脚本后酌情修改后试用
目录结构
- xxxx
- Xxx1Api/
- Xxx2Api/
- git_clone_api.sh
- git_branch_dev.sh
- git_pull_all.sh
- git_status.sh
- api-build-tag.sh
- api-commit-push.sh
- api-dev-release-merage.sh
- api-update-nuget-pack.sh
2022年12月20日大约 3 分钟
基于微服务项目,产生的的多项目仓库管理脚本。可直接保存 shell 脚本后酌情修改后试用
某日,看到一个营销号的视频说做视频日进斗金,大意是用软件识别文章小说,搭配一些图片转换成自己的视频。看完当时脑海里冒出一个念头,我也可以,于是有了这番尝试。
脚本依赖环境:Windows,GO,GIT
脚本将创建 temp 目录,并拷贝相关包到第一个 GOPATH 中
可将脚本保存到本地自行添加被墙或者常用的包
@echo off
setlocal enabledelayedexpansion
set currentPath=%~dp0
set tempDir=%currentPath%temp
set str="%gopath%"
for /f "delims=;, tokens=1,*" %%a in (%str%) do (
set godir= %%a
)
REM gopath第一个目录
set workPath=!godir!\src
echo GOPATH:%workPath%
if not exist %tempDir% md %tempDir%
if not exist %tempDir%\grpc\ (
call git clone https://github.com/grpc/grpc-go %tempDir%\grpc
call xcopy %tempDir%\grpc %workPath%\google.golang.org\grpc /s /e /Q /Y /I
)
if not exist %tempDir%\genproto\ (
call git clone https://github.com/google/go-genproto.git %tempDir%\genproto
call xcopy %tempDir%\genproto %workPath%\google.golang.org\genproto /s /e /Q /Y /I
)
if not exist %tempDir%\net (
call git clone https://github.com/golang/net %tempDir%\net
call xcopy %tempDir%\net %workPath%\golang.org\x\net /s /e /Q /Y /I
)
if not exist %tempDir%\sys (
call git clone https://github.com/golang/sys %tempDir%\sys
call xcopy %tempDir%\sys %workPath%\golang.org\x\sys /s /e /Q /Y /I
)
if not exist %tempDir%\text (
call git clone https://github.com/golang/text.git %tempDir%\text
call xcopy %tempDir%\text %workPath%\golang.org\x\text /s /e /Q /Y /I
)
注释:rem 注释~~
输出:echo hello world
接收用户输入:%1 %2,第n个变量就用%n表示
当前脚本路径:%~dp0
当前目录路径:%cd%
设置变量:set currentPath=%cd%
关闭回显:@echo off //隐藏执行路径,@表示包含echo off这条命令也不现实路径
请按任意键继续:pause
调用外部程序:start xxx.exe
等待子程序执行完毕:call start xxx.exe
切换当前目录:cd /d 路径
显示下级子目录名称:dir /b /a:d
显示下级子文件名称:dir /b /a:-d
命令连接符:cmd1&cmd2,在cmd1执行成功后执行cmd2
字符串分割:``
复制:xcopy 要复制的目录 目标目录 /s /e /Q /Y /I
网站做了站点缓存,测试的时候修改数据后需要重启站点来清楚缓存
如何无需登陆服务器又不用改代码就可以清理换网站上的缓存呢?
用重启iis怎么样~
能重启IIS,自然也能干其他的
连接到远程主机
在远程主机一个创建一个包含iisreset命令(+移除计划任务)的脚本
给远程主机添加一项过期的计划任务
立即执行计划任务