$ sudo crontab -e
Copy and pate the command line below:0 9 * * * /usr/bin/aptitude -y update && /usr/bin/aptitude -y full-upgrade && /usr/bin/aptitude -y autoclean && /sbin/shutdown -P now
Every 9 am, this command will update online DB of the software installed in your Ubuntu machine, update some of them, clean any unused files, and subsequently shutdown your machine.
For example, my legacy laptop benefits much from this automatic update, because the occasional update slows down my Ubuntu. Every evening I come back home, my old slow machine is already updated up-to-date and secure.
Posted by Minkee