1
複数のターミナルサーバーでファームウェアを更新するためのスクリプトを作成しています。これまでのところ、スクリプトが...私は私が(いや、はい)再起動したいかどうか尋ねたんだ最後のステップまで最後にプロンプトが失敗するスクリプトを期待する
を完璧なまでに機能CLIは、端末のためのコマンド:
--:#- [system_tools] cli-> download
--:#- [system_tools] cli-> install
Jun 12 23:49:19 xx.xx.com event_notify: EVT[11]:Image upgrade started. User: root. Current version: 2.5.0.12. New version: 3.1.0.13.
finish
Jun 12 23:51:34 xx.xx.com event_notify: EVT[12]:Image upgrade result. Result: 0. New firmware version: 3.1.0.13.
--:#- [system_tools] cli-> finish
--:-/cli-> reboot
Rebooting the appliance will cause all currently active sessions to be disconnected.
Are you sure you want to reboot the appliance? (yes, no) :
これらは、expectスクリプトの最後の数行です。
send "finish\r"
expect "$"
send "reboot\r"
expect "Rebooting the appliance will cause all currently active sessions to be disconnected.Are you sure you want to reboot the appliance? (yes, no) : "
send "yes\r"
ただし、yes
は送信されません。スクリプトは次のところで終了します:
Are you sure you want to reboot the appliance? (yes, no) :
これ以上終了しません。私はここで何が欠けていますか? "yes\r"
が送信されないのはなぜですか?
ありがとうございました
アドオンを使用して期待していたスクリプトのデバッグや' ''送る "はい\ R" の後にeof'期待しています。 – pynexj
それはうまくいった!ありがとう! –