Created
October 1, 2022 13:13
-
-
Save solrevdev/0a28fefaed20055d84a6d6e17de19e6b to your computer and use it in GitHub Desktop.
A bash script that times how long it takes to run apt-get update, upgrade and snap refresh
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 | |
# store the current date into a variable called startTime | |
startTime=$(date +"%s") | |
echo "Start time: $(date)" | |
# do the updating or whatever here | |
sudo apt-get update && sudo apt-get upgrade -y && sudo apt-get autoremove -y && sudo snap refresh | |
finishTime=$(date +"%s") | |
echo "End time: $(date)" | |
# write out how long script took to run | |
diff=$(($finishTime-$startTime)) | |
echo "$(($diff / 3600)) hours, $((($diff / 60) % 60)) minutes and $(($diff % 60)) seconds elapsed." |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment