linux下使用shell脚本批处理命令

1.新建脚本touch first.sh

2.写入命令vi first.sh

#!/bin/bash
#publish service and api

echo "copy file"
docker cp /home/huqing/dotnet/a.zip common_api:/usr/api/a.zip
docker cp /home/huqing/dotnet/b.zip common_service:/usr/service/b.zip
echo "unzip file"
docker exec common_api unzip -o -d /usr/api /usr/api/a.zip
docker exec common_service unzip -o -d /usr/service /usr/service/b.zip
echo "shutdown superviser"
docker exec common_api supervisorctl shutdown
docker exec common_service supervisorctl shutdown
echo "start superviser"
docker exec common_api supervisord -c /etc/supervisor/supervisord.conf
docker exec common_service supervisord -c /etc/supervisor/supervisord.conf
echo "check ps"
docker exec common_api ps -ef | grep businessplus
docker exec common_service ps -ef | grep businessplus
echo "done"

3.执行命令sh first.sh

原文地址:https://www.cnblogs.com/qinghub/p/6401079.html