2013-10-27 3 views
1

OK на основе некоторых дополнительных исследований и ни ответа ниже, это то, что я хотел бы мой сценарий, чтобы сделать:создать скрипт для установки обновлений

  1. извлечь обновления
  2. установкой обновлений в определенный порядок
  3. подождать несколько секунд для обновления ня закончить для каждой секции
  4. сбросить пароль корневой учетной записи (как я жёстко или установить, что с помощью сценария?)
  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 
    

отредактирована для обновления и извиниться за то, что нуб !

ответ

2

Добавить -y (говорит ням считать "да" ответов), как это:

yum -y update *.rpm 
+0

Благодаря CharlesB Хороший вызов. ;) – jerdiggity

+0

спасибо! этот ответ идеален! – user2924544

Смежные вопросы