1.新建腳本touch first.shdocker
2.寫入命令vi first.shapi
#!/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.shbash