1
OK,這是我想我的腳本做什麼:創建一個shell腳本來安裝更新基於一些額外的研究和低於百勝答案
- 提取更新
- 安裝的更新特定的順序
- 等待幾秒鐘,百勝完成更新每個部分
- 重新設置root帳戶密碼(我怎麼硬編碼或通過腳本設置?)
- 重置ssh帳號密碼(該怎麼辦我硬編碼或通過腳本設置?)
- 清除歷史記錄
- 刪除文件
提示重新啓動
#!/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
編輯的更新和作爲一個小白道歉!
感謝CharlesB良好的通話。 ;) – jerdiggity
謝謝!那個答案是完美的! – user2924544