Linux
期望自動化對 CLI 的肯定回答
當我
ambari-server upgrade
從 bash 腳本執行命令時,在升級過程中我們遇到了問題已備份 Ambari Server 數據庫
$$ y/n $$(是)?
yes
所以我們希望通過期望在問題出現時發送的腳本來自動化這個過程。請建議如何
ambari-server upgrade
按預期自動化ambari-server upgrade Using python /usr/bin/python Upgrading ambari-server INFO: Upgrade Ambari Server INFO: Updating Ambari Server properties in ambari.properties ... WARNING: Can not find ambari.properties.rpmsave file from previous version, skipping import of settings INFO: Updating Ambari Server properties in ambari-env.sh ... INFO: Can not find ambari-env.sh.rpmsave file from previous version, skipping restore of environment settings. ambari-env.sh may not include any user customization. INFO: Fixing database objects owner Ambari Server configured for Embedded Postgres. Confirm you have made a backup of the Ambari Server database [y/n] (y)? INFO: Upgrading database schema INFO: Return code from schema upgrade command, retcode = 0 INFO: Console output from schema upgrade command: INFO: {"lzo_enabled":"false"} INFO: Schema upgrade completedAdjusting ambari-server permissions and ownership... Ambari Server 'upgrade' completed successfully.
您可以通過管道
yes
輸入您的腳本:yes | ambari-server upgrade
這將導致每個提示都以 回复
y
。