Cron Job for updates and reboot

Add a -y flag on the autoremove (it’s interactive, like upgrade).

The unattended-upgrades package is installed and configured by MiaB.

Has anyone tried Livepatch?

My VPS login intro says it is available.

Canonical is the company that maintains Ubuntu. Those login messages are part of the built-in “message of the day” (MOTD) which are essentially advertisements for Canonical products.

I know. For a small user it is free.

1 Like

Grate, thank you.
Here is an updated version. I forgot to change the grep parse. Please use carefully. This one includes a conditional else. This way, if it failed, no reboot will occur. My next step is to send a notification of failure, via email or something.

-Jeremy

http://paste.ubuntu.com/p/hkBMwKQJC2/

I did make a fix on this new update, see below. I am feeling pretty confidant on this, so I am going to add it as a cronjob.

Use at you own risk. But, as you can see, it’s plain text, so, the advise of look both ways before crossing also applies while crossing a street.

http://paste.ubuntu.com/p/kSC932MQvF/

for crontab I run it as root, then put the following two lines in to run it every day.

MAILTO="logreport@xyzs.co"

  • 0 * * * /home/jb/bin/autoupdatenightly.sh > /home/jb/bin/autoupdatenightly.sh.log

This topic was automatically closed 40 days after the last reply. New replies are no longer allowed.