-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathmintain.sh
108 lines (88 loc) · 2.31 KB
/
mintain.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
#!/bin/bash
# Mintain
# Linux maintenance script
bold="\033[1m"
nocolor="\033[0m"
red="\033[1;31m"
green="\033[1;32m"
yellow="\033[1;33m"
clear
printf "
#######################################
# Bash script for Linux maintenance #
# Updates, upgrades, and cleans up. #
# Made with Linux Mint 18 (sarah) #
# Will work with most linux systems #
#######################################
"
printf "
Commands include: -update
\t\t -upgrade
\t\t -dist-upgrade
\t\t -update-grub
\t\t -autoremove
\t\t -autoclean
\t\t -empty-trash
\t\t -clean
\t\t 'dist-upgrade' will prompt (y/n)
\t\t option to update again IF upgrades exist (prompts)\n\n
"
read -n 1 -s -p "Press any key to continue.. "
clear
#com1
printf "\n${bold}Command 1: ${yellow}update ${nocolor}\n"
sudo apt-get update && printf "\n"
#start timer
start=$SECONDS
#com2
printf "${bold}Command 2: ${yellow}upgrade ${nocolor}\n"
sudo apt-get upgrade && printf "\n"
#com3
read -p "$(printf ${bold}"Command 3:"${yellow}" dist-upgrade? (y/n) "${nocolor})" -n 1 -r
printf "\n"
if [[ $REPLY =~ ^[Yy]$ ]]
then
sudo apt-get dist-upgrade
fi
printf "\n"
#re-update
read -p "$(printf ${bold}"Re-update:"${yellow}" update again? (y/n) "${nocolor})" -n 1 -r
printf "\n"
if [[ $REPLY =~ ^[Yy]$ ]]
then
sudo apt-get update
fi
printf "\n"
#com4
printf "${bold}Command 4: ${yellow}update-grub ${nocolor}\n"
sudo update-grub && printf "\n"
#com5
printf "${bold}Command 5: ${yellow}autoremove ${nocolor}\n"
sudo apt-get autoremove && printf "\n"
#com6
printf "${bold}Command 6: ${yellow}autoclean ${nocolor}\n"
sudo apt-get autoclean && printf "\n"
#com7-trash
read -p "$(printf ${bold}"Command 7:"${yellow}" empty trash? (y/n) "${nocolor})" -n 1 -r
printf "\n"
if [[ $REPLY =~ ^[Yy]$ ]]
then
trash-empty && printf "" || printf "Skipped. trash-cli not installed\n"
printf "Done\n"
fi
printf "\n"
#com8
printf "${bold}Command 8: ${yellow}clean ${nocolor}\n"
sudo apt-get clean && printf "\n"
#done
pad=" "
printf "$pad ${bold}Done ${yellow}and Done.${nocolor} >>> ${bold}All Systems Go ${nocolor}\n\n"
sleep 0.5
#end timer
end=$SECONDS
printf "$pad ${bold}Time ${yellow}elapsed:${red} $((end-start)) seconds ${nocolor}\n\n\n"
sleep 0.5
#return prompt
padd=" "
printf "$padd ${yellow}Here's your prompt.. ${nocolor}\n\n"
sleep 0.2