From abac3cb13a534f100e99044d81c5eca9de3c045c Mon Sep 17 00:00:00 2001 From: David Lawson Date: Fri, 11 Jan 2019 01:12:17 -0500 Subject: [PATCH] updated version a little neater --- mintain | 122 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 122 insertions(+) create mode 100644 mintain diff --git a/mintain b/mintain new file mode 100644 index 0000000..a95039d --- /dev/null +++ b/mintain @@ -0,0 +1,122 @@ +#!/bin/bash +# Mintain - Small bash script for Linux maintenance (updating and cleaning). +# Commands include: update, upgrade, dist-upgrade, update-grub, autoremove, autoclean, +# empty-trash, clean. +# dist-upgrade will prompt (y/n), skip if not sure. +# version 2.0 + +BOLD="\033[1m" +NOCOLOR="\033[0m" + +RED="\033[1;31m" +GREEN="\033[1;32m" +YELLOW="\033[1;33m" #*_* + +LIGHTRED="\033[1;91m" +LIGHTYELLOW="\033[1;92m" +LIGHTYELLOW="\033[1;93m" + + +clear +echo +echo "#######################################" +echo "# Bash script for Linux maintenance #" +echo "# Updates, upgrades, and cleans-up. #" +echo "# Made with Linux Mint 18 (sarah) #" +echo "# Will work for many other distros #" +echo "#######################################" + + +echo +sleep 0.2 +echo "Commands include: -update" +echo " -upgrade" +echo " -dist-upgrade" +echo " -update-grub" +echo " -autoremove" +echo " -autoclean" +echo " -empty-trash" +echo " -and clean (in that order)" +echo +echo " 'dist-upgrade' will prompt (y/n)" +echo " option to update again IF upgrades were available (prompts)" +sleep 0.4 +echo +echo +read -n 1 -s -p "Press any key to continue.. " +clear + + +#com1 +echo +echo -e "${BOLD}Command 1: ${YELLOW}update ${NOCOLOR}" +sudo apt-get update +echo + +#timer +start=$SECONDS + +#com2 +echo -e "${BOLD}Command 2: ${YELLOW}upgrade ${NOCOLOR}" +sudo apt-get upgrade +echo + +#com3 +read -p "$(echo -e Command 3:$BOLD$YELLOW" dist-upgrade? (y/n) "$NOCOLOR)" -n 1 -r +echo + if [[ $REPLY =~ ^[Yy]$ ]] + then + sudo apt-get dist-upgrade + fi +echo + +#re-update +read -p "$(echo -e Re-update:$BOLD$YELLOW" update again? (y/n) "$NOCOLOR)" -n 1 -r +echo + if [[ $REPLY =~ ^[Yy]$ ]] + then + sudo apt-get update + fi +echo + +#com4 +echo -e "${BOLD}Command 4: ${YELLOW}update-grub ${NOCOLOR}" +sudo update-grub2 +echo + +#com5 +echo -e "${BOLD}Command 5: ${YELLOW}autoremove ${NOCOLOR}" +sudo apt-get autoremove +echo + +#com6 +echo -e "${BOLD}Command 6: ${YELLOW}autoclean ${NOCOLOR}" +sudo apt-get autoclean +echo + +#com7 +echo -e "${BOLD}Command 7: ${YELLOW}empty trash ${NOCOLOR}" +sudo trash-empty +echo + +#com8 +echo -e "${BOLD}Command 8: ${YELLOW}clean ${NOCOLOR}" +sudo apt-get clean +echo + +#done +echo -e "${BOLD} Done ${YELLOW}and Done.${NOCOLOR} >>> ${BOLD}All Systems Go. ${NOCOLOR}" +echo +sleep 0.5 + +#endTimer +end=$SECONDS +echo -e "${BOLD} Time ${YELLOW}elapsed:${NOCOLOR} ${BOLD}$((end-start)) seconds. ${NOCOLOR}" +echo +echo +sleep 0.5 + +#return prompt +echo -e " ${YELLOW}Here's your prompt.. ${NOCOLOR}" +sleep 0.5 +echo