Permalink
Browse files

sorted errors, added confimation script

  • Loading branch information...
1 parent 42cfa3d commit 50faf2e123380a2beb2559430df31babf696e426 monkeypuddles committed Jan 19, 2013
Showing with 58 additions and 38 deletions.
  1. +58 −38 gerbal.sh
View
@@ -59,38 +59,22 @@ function ConfirmOrExit() {
g1 "$CONFIRM. Continuing ..."
}
-function timetoexit() {
+
+function continueornot() {
while true
do
- g2 -n "The next section will run updated to os and system. Do you wish to proceed with this? (y or n) :"
- read CONFIRM
- case $CONFIRM in
- y|Y|YES|yes|Yes) break ;;
- n|N|no|NO|No)
- g1 "We are done then!" $CONFIRM
- exit
- ;;
- *) g2 "Please enter only y or n"
- esac
- done
- g1 "starting Aptitude for updates $CONFIRM. Continuing ..."
-}
-
-function debianornot() {
- while true
- do
- g2 -n "Are you running a Debian build? (y or n) :"
- read CONFIRM
- case $CONFIRM in
- y|Y|YES|yes|Yes) break ;;
- n|N|no|NO|No)
- g1 "I'm sorry, Gerbal perfers Debian builds at the moment only, Try back later" $CONFIRM
- exit
- ;;
- *) g2 "Please enter only y or n"
- esac
- done
- g1 "Starting Updates now $CONFIRM."
+ g2 -n "Do you wish to continue? (y or n)"
+ read CONFIRM
+ case $CONFIRM in
+ y|Y|YES|yes|Yes) break ;;
+ n|N|no|NO|No)
+ g1 "Gerbal says Goodby then !" $CONFIRM
+ exit
+ ;;
+ *) g2 "please enter only y or n"
+ esac
+ done
+ g1 "Continuing!" $CONFIRM
}
#welcome message
@@ -99,30 +83,30 @@ g3 "Welcome to Gerbal!, a script writen to make YOUR life easier."
g3 "This script will help you to do task on the server with some automation."
sleep 3
g3 "Keep in mind it only does what you TELL, it to do ;) "
-ConfirmOrExit
+continueornot
#start with checking uptime!
sleep 3
g4 "Checking server uptime..."
uptime
sleep 1
-ConfirmOrExit
+continueornot
#check free memory
g4 "Checking free memory..."
free -t -m
-ConfirmOrExit
+continueornot
#checking for memory in consumption
g4 "Checking Memory Usage"
egrep -h --color 'Mem|Cache|Swap' /proc/meminfo
g3 "all done with memory checks!"
-ConfirmOrExit
+continueornot
#checking diskspace
g4 "Checking server disk space"
df -h
-ConfirmOrExit
+continueornot
#checking amount of disk used per user account
g4 "Checking disk usage for /home directories"
@@ -139,27 +123,63 @@ g1 "Disk useage on user andrewph"
g4 "disk useage print out done"
g4 "read your profile's Disk useage printout, if it seems overly large, please consider cleaning up your home directory ;) thx!"
-ConfirmOrExit
+continueornot
#checking ports open on server
g4 "checking what ports are open on server!"
netstat -tulpn
sleep 3
-ConfirmOrExit
+continueornot
g4 "Checking on ping to outside"
sleep 2
ping www.google.com -c 5
-ConfirmOrExit
+continueornot
#This part is based on debian build for aptitude and apt-get controls
#will have to be changed if used on a CentOS build
g4 "OK now for the fun stuff!!"
+#asks if you have a debain kernal installed, if not; exits
+function debianornot() {
+ while true
+ do
+ g2 -n "Are you running a Debian build? (y or n) :"
+ read CONFIRM
+ case $CONFIRM in
+ y|Y|YES|yes|Yes) break ;;
+ n|N|no|NO|No)
+ g1 "I'm sorry, Gerbal perfers Debian builds at the moment only, Try back later" $CONFIRM
+ exit
+ ;;
+ *) g2 "Please enter only y or n"
+ esac
+ done
+ g1 "Starting Updates now $CONFIRM."
+}
+
#run Warning about debian build, if yes continue to next session
debianornot
+#ask if you want to install updates if not; exits
+function timetoexit() {
+ while true
+ do
+ g2 -n "The next section will run updated to os and system. Do you wish to proceed with this? (y or n) :"
+ read CONFIRM
+ case $CONFIRM in
+ y|Y|YES|yes|Yes) break ;;
+ n|N|no|NO|No)
+ g1 "We are done then!" $CONFIRM
+ exit
+ ;;
+ *) g2 "Please enter only y or n"
+ esac
+ done
+ g1 "starting Aptitude for updates $CONFIRM. Continuing ..."
+}
+
#run warning about apt-get update, if yes continue with updates
timetoexit

0 comments on commit 50faf2e

Please sign in to comment.