脚本是个好东西

Linux下使用shell脚本可以完成很多任务,如执行脚本部署测试环境、批量添加系统用户(之前做edusoho二次开发时用到)、监控项目运行情况(如果宕机,自动重启)等。

总而言之,一台或者多台Linux,如果你不能熟练的掌握shell脚本的话,如巡检之类的重复性工作会累死人的。

另外不仅仅是Linux,像我本地自己平时兴趣爱好写一些小demo也用到shell脚本或bat脚本。

如最近博客项目需要启动Redis、Mongodb、ES等,但一个个手动启动实在是非常麻烦,于是我将其抽为一个bat脚本,只需桌面点击,应用全部启动,非常节约时间。

我的bat脚本内容如下:

echo start

echo mongo START
start /d "D:Program FilesMongoDBServer4.2in" mongo.exe

echo redis START
start /d "D:Program FilesRedis-x64-3.2.100" redis-server.exe

echo elasticsearch START
start /d "D:Program Fileselasticsearch-5.6.16in" elasticsearch.bat
原文地址:https://www.cnblogs.com/youcong/p/12846822.html