Last active
September 27, 2017 22:58
-
-
Save ericmagnuson/a8b67706dc4415d23b5a0c6e8aa7363e to your computer and use it in GitHub Desktop.
Vega Upgrades
This file contains hidden or 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 | |
# | |
# Updates the entire system. Booyah. | |
set -e | |
start=`date +%s` | |
printf '%*s\n' '80' '' | tr ' ' = | |
printf "| Upgrades starting.\n" | |
printf "| $(date +"%Y-%m-%d %T %Z")\n" | |
printf '%*s\n' '80' '' | tr ' ' = | |
printf "\n" | |
printf "| Updating Ubuntu.\n" | |
printf '%*s\n' '80' '' | tr ' ' - | |
apt update && apt upgrade -y && apt autoremove -y | |
printf "\n" | |
printf "| Updating npm.\n" | |
printf '%*s\n' '80' '' | tr ' ' - | |
npm update -g && npm i -g npm | |
printf "\n" | |
printf "| Renewing certificates.\n" | |
printf '%*s\n' '80' '' | tr ' ' - | |
service nginx stop && \ | |
service varnish stop && \ | |
service apache2 stop && \ | |
letsencrypt renew && \ | |
service apache2 start && \ | |
service varnish start && \ | |
service nginx start | |
end=`date +%s` | |
runtime=$((end-start)) | |
printf "\n" | |
printf '%*s\n' '80' '' | tr ' ' = | |
printf "| Upgrades finished in "$runtime" seconds.\n" | |
printf "| $(date +"%Y-%m-%d %T %Z")\n" | |
printf '%*s\n' '80' '' | tr ' ' = | |
printf "\n" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment