快速更新
This commit is contained in:
		
							
								
								
									
										10
									
								
								update.sh
									
									
									
									
									
								
							
							
						
						
									
										10
									
								
								update.sh
									
									
									
									
									
								
							@@ -5,10 +5,20 @@ host="root@main"
 | 
			
		||||
go mod tidy
 | 
			
		||||
go build -o dist/main bin/main.go
 | 
			
		||||
 | 
			
		||||
# 重命名旧文件
 | 
			
		||||
ssh $host "mv ~/webp/main ~/webp/main_old"
 | 
			
		||||
 | 
			
		||||
# 上传到服务器, 然後刪除本地文件
 | 
			
		||||
scp dist/main $host:~/webp/main
 | 
			
		||||
rm -rf dist
 | 
			
		||||
 | 
			
		||||
# 重载服务
 | 
			
		||||
ssh $host "pm2 reload webp"
 | 
			
		||||
 | 
			
		||||
# 删除旧文件
 | 
			
		||||
ssh $host "rm ~/webp/main_old"
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
# pm2 start /root/webp/main --name webp --watch
 | 
			
		||||
 | 
			
		||||
# 查看 main_ 的進程, 然後使用 kill -9 强制关闭
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user