2011-11-21 29 views
3

我無法弄清楚commandResource的實際外觀。我見過的唯一的例子在下面列出Apache's page(不是非常有幫助)Ant sshexec commandResource示例

<sshexec host="somehost" 
    username="dude" 
    keyfile="${user.home}/.ssh/id_dsa" 
    commandResource="to_run"/> 

所以我peice的看起來像這樣

<sshexec host="${host}" 
    trust="yes" 
    username="${username}" 
    password="${password}" 
    commandResource="Commands.txt"/> 

如何設計commands.txt中的格式?我想要做的是:

命令1:sudo的用戶runscript.sh

命令2:「$ {}密碼」(密碼需要在腳本中輸入以及)

回答

2

一個例子可以在相關bug

Commands.txt:    
touch 1.txt 
mv 1.txt 2.txt 
mv 2.txt 3.txt 

每一行必須包含一個命令,其具有要被執行找到。

你試圖做的事情是行不通的。你不能以這種方式設置密碼,這不是一個命令,而是一個控制檯輸入。

也許你應該只給用戶sudo的權限執行該腳本。

相關問題