I used to having to manually type into my console "sudo apt update" and "sudo apt upgrade" to update my packages. Of course, it's not rocket science to do, but it often gets repetitive to do. Due to this and my knowledge of Python, I wrote a simple Python script to automatically update it by only running it once and letting it does it thing.
What it does
It updates your Ubuntu machine by ensuring that the apt-get package manager is running using check_output() and if so, it runs "sudo apt update" and "sudo apt upgrade" to update the packages and then run "sudo apt autoremove" to clean up any unnecessary installed packages. Its great for Ubuntu servers since you can run it once and then not have to worry about going through the long process of reconnecting to your server to update it.
What I Learned
- I learned about how subprocess works and what kind of commands you can get it to run
- I got to improve my skills in using Python