Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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
You can’t perform that action at this time.