CLI에 대한 자동 예 응답을 기대합니다.

CLI에 대한 자동 예 응답을 기대합니다.

bash 스크립트에서 명령을 실행할 때 ambari-server upgrade업그레이드 중에 문제가 발생합니다.

이미 Ambari 서버 데이터베이스를 백업했습니다 [y/n] (y)?

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.

답변1

yes입력을 스크립트로 파이프할 수 있습니다 .

yes | ambari-server upgrade

그러면 모든 프롬프트에 응답하게 됩니다 y.

관련 정보