Skip to content

Instantly share code, notes, and snippets.

@AbhishekGhosh
Created February 4, 2015 03:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save AbhishekGhosh/af0307dbfd87a76f5914 to your computer and use it in GitHub Desktop.
Save AbhishekGhosh/af0307dbfd87a76f5914 to your computer and use it in GitHub Desktop.
HP Cloud Bash Script to SSH and Update Ubuntu Server
#!/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