Skip to content

Instantly share code, notes, and snippets.

@iamramahibrah
Created May 17, 2021 09:52
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 iamramahibrah/834021f28088434d51515ad5af4aa19f to your computer and use it in GitHub Desktop.
Save iamramahibrah/834021f28088434d51515ad5af4aa19f to your computer and use it in GitHub Desktop.
#!/bin/bash
#=====================================
# OPEN SSH SERVER UPGRADE SCRIPT
#=====================================
function colors()
{
RED="\033[1;31m"
GREEN="\033[1;32m"
BLUE='\033[34;1m'
YELLOW='\033[33;1m'
NOCOLOR="\033[0m"
}
colors
function root()
{
if [[ $EUID -ne 0 ]]; then
echo -e "$RED This script must be run as root $NOCOLOR"
exit 1
fi
}
root
function update()
{
if ping -q -c 1 -w 1 8.8.8.8 >/dev/null; then
echo -e " Internet $GREEN ● $NOCOLOR "
sudo apt update
sudo apt install --only-upgrade openssh-server -y
else
echo -e " Internet $RED ● $NOCOLOR"
fi
}
update
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment