Question

Keep Droplets updated Ubuntu 16.04

Im working on setting up a lot of droplets, on Ubuntu 16.04, However it is very time consuming to go into each of the droplets and run sudo apt-get update and sudo apt-get dist-upgrade.

So what I have done is I have added following into my root crontab: sudo crontab -u root -e

0 3 * * * root /usr/bin/apt-get update && /usr/bin/apt-get dist-upgrade -q -y >> /var/log/apt/myupdates.log

However it is not working, and I was wondering if there is other things I need to think about?

PS: I have followed DO tutorials on how to disable root, so I dont have a root user, is this a problem?

Thanks

Subscribe
Share

Submit an answer
You can type!ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Accepted Answer

Your idea is good, and removing root would fix it, but I suggest looking into this as it provides more options and integrates better: https://help.ubuntu.com/16.04/serverguide/automatic-updates.html

  1. You do have a root user, the password is disabled(! in /etc/shadow), but you can still use sudo -i, su is blocked.
  2. Remove root from the entry, it should be: 0 3 * * * /usr/bin/apt-get update && /usr/bin/apt-get dist-upgrade -q -y >> /var/log/apt/myupdates.log (I had the same issue a few months ago)