2016-12-26 133 views

回答

0
/tmp/sh.sh is shell script on remote server. 

#!/bin/bash 
ssh "[email protected]" 'sh -c "((nohup /tmp/sh.sh))"'  

#use following for suppressing the output from remote server script. 
ssh "[email protected]" 'sh -c "((nohup /tmp/sh.sh &>/dev/null) &)"' 
+0

我有一個疑問這個問題,難道我們不需要任何密碼的,因爲我連接到其他服務器。在你的代碼中表示沒有提及密碼? – sandeepKumar

+1

@sandeepKumar用私鑰設置ssh。 – Barmar