Created
February 7, 2020 18:42
-
-
Save thegulshankumar/a3f35c0348da82231c78115f7ff701c4 to your computer and use it in GitHub Desktop.
Update Ubuntu Server Bash
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| TEXT_RESET='\e[0m' | |
| TEXT_YELLOW='\e[0;33m' | |
| TEXT_RED_B='\e[1;31m' | |
| sudo apt update | |
| echo -e $TEXT_YELLOW | |
| echo 'APT update finished...' | |
| echo -e $TEXT_RESET | |
| sudo apt upgrade -y | |
| echo -e $TEXT_YELLOW | |
| echo 'APT upgrade finished...' | |
| echo -e $TEXT_RESET | |
| sudo apt dist-upgrade | |
| echo -e $TEXT_YELLOW | |
| echo 'APT distributive upgrade finished...' | |
| echo -e $TEXT_RESET | |
| sudo apt autoclean -y | |
| echo -e $TEXT_YELLOW | |
| echo 'APT auto clean finished...' | |
| echo -e $TEXT_RESET | |
| sudo apt autoremove -y | |
| echo -e $TEXT_YELLOW | |
| echo 'APT auto remove finished...' | |
| echo -e $TEXT_RESET | |
| if [ -f /var/run/reboot-required ]; then | |
| echo -e $TEXT_RED_B | |
| echo 'Reboot required!' | |
| echo -e $TEXT_RESET | |
| echo -e $TEXT_YELLOW | |
| read -r -p "Do you want to reboot now? [Y/n]" response | |
| response=${response,,} | |
| echo -e $TEXT_RESET | |
| if [[ $response =~ ^(yes|y| ) ]] || [[ -z $response ]]; then | |
| sudo reboot | |
| fi | |
| fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment