Created
February 4, 2015 03:16
-
-
Save AbhishekGhosh/af0307dbfd87a76f5914 to your computer and use it in GitHub Desktop.
HP Cloud Bash Script to SSH and Update Ubuntu Server
This file contains 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 | |
# | |
# Author : Dr. Abhishek Ghosh | |
# GNU GPL 3.0 | |
# https://thecustomizewindows.com | |
# HP Cloud Bash Script to SSH and Update Ubuntu Server | |
# run on production server with your risk | |
# for educational purpose | |
echo "You Are Going To SSH and Update Your Server" | |
echo "Supply the path of .pem key:" | |
read key | |
echo "Supply the IP address below:" | |
read ip | |
echo " " | |
ssh -t -t -i $key ubuntu@$ip <<'ENDSSH' | |
free -m | grep "Mem:" | awk '{ print "Total memory (used+free): " $3 " + " $4 " = " $2 }' | |
clear | |
sudo su && sudo apt-get update -y && sudo apt-get upgrade -y | |
echo " " | |
exit | |
exit | |
ENDSSH | |
finish=`date "+%Y-%m-%d-%H-%M-%S"` | |
echo "Update and Upgrade of $ip completed at ${finish}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment