1

いくつかの追加の調査と以下の yum の回答に基づいて、これが私のスクリプトで実行したいことです。

  1. アップデートを抽出する
  2. 特定の順序でアップデートをインストールする
  3. 各セクションの yum 更新が完了するまで数秒待ちます。
  4. root アカウントのパスワードをリセットします (スクリプトを使用してハードコーディングまたは設定するにはどうすればよいですか?)
  5. ssh アカウントのパスワードをリセットします (スクリプトを介してハードコーディングまたは設定するにはどうすればよいですか?)
  6. 履歴をクリアする
  7. ファイルを削除します
  8. 再起動を促す

    #!/bin/sh
    # Run as root
    
    # This extracts the tar copied to the server
    tar -xf updates
    sleep 5
    tar -xf app
    sleep 2
    
    # This moves to the February updates and install it.
    cd /updates/feb
    yum -y update *.rpm
    sleep 5
    # This moves to the March updates and install it.
    cd /updates/mar
    yum -y update *.rpm
    sleep 5
    # This moves to the April updates and install it.
    cd /updates/apr
    yum -y update *.rpm
    sleep 5
    # This moves to the May updates and install it.
    cd /updates/may
    yum -y update *.rpm
    sleep 5
    # This moves to the June updates and install it.
    cd /updates/june
    yum -y update *.rpm
    sleep 5
    # This moves to the August updates and install it.
    cd /updates/aug
    yum -y update *.rpm
    sleep 5
    # This moves to the September updates and install it.
    cd /updates/sep
    yum -y update *.rpm
    sleep 5
    # This moves to the APP dependencies and install it.
    cd /updates/app
    yum -y install *.rpm
    sleep 5
    # This resets the root password
    passwd root
    # This resets the ssh account password
    passwd ssh_user
    # This removes the files from the home directory
    cd /home/user
    rm -rf /updates
    wait 5
    # This clears the history and screen
    history -c
    clear
    # This reboots the server with a y/n prompt
    reboot
    

更新のために編集し、初心者であることをお詫びします!

4

1 に答える 1

2

次のように追加-yします (「はい」の回答を想定するように yum に指示します):

yum -y update *.rpm
于 2013-10-27T07:41:09.050 に答える