Question: Currently, to get things up to date on my Raspberry Pi, I have to type in `sudo apt-get update` and `sudo apt-get upgrade`. Is there a way to set it up to automatically do this? I am running Raspbian Jessie.

Answer: 
Instead of a manual cron, you can install [`unattended-upgrades`](https://wiki.debian.org/UnattendedUpgrades), which is useful to ensure the latest kernels are installed. It's mostly designed for security.

```
apt-get install unattended-upgrades

```

There are some bits that can be adjusted/configured, but the default is fine.
In its default configuration, `unattended-upgrades` is broken in Raspbian Buster. It won't install crucial updates for the kernel and other software. Your options are:

**Recommended Option:**

* Install and [fix unattended-upgrades](https://raspberrypi.stackexchange.com/questions/38931/how-do-i-set-my-raspberry-pi-to-automatically-update-upgrade#comment130516_38990):

```
sudo apt install unattended-upgrades

echo 'Unattended-Upgrade::Origins-Pattern {
//      Fix missing Rasbian sources.
        "origin=Debian,codename=${distro_codename},label=Debian";
        "origin=Debian,codename=${distro_codename},label=Debian-Security";
        "origin=Raspbian,codename=${distro_codename},label=Raspbian";
        "origin=Raspberry Pi Foundation,codename=${distro_codename},label=Raspberry Pi Foundation";
};' | sudo tee /etc/apt/apt.conf.d/51unattended-upgrades-raspbian

```

For faster security updates (but less stability, as the packages haven't been approved for rasbian), you can add debian-security packages to apt:

```
echo 'deb http://deb.debian.org/debian-security/ buster/updates main contrib non-free' | sudo tee /etc/apt/sources.list.d/debian-security.list

```

You will probably need to [install new apt keys for the debian repository](https://unix.stackexchange.com/a/205732).

**Other Options:**

* Work around it with by using cron-apt:
`sudo apt install cron-apt`

It's recommended to use unattended-updates and fix the package, because it's best suited for the purpose. Cron-apt is your second-best option, because it's also designed for a similar purpose. I'm not sure cron-apt can automatically reboot your system after a kernel update. Unattended-upgrades has that option, and in my experience reboot after kernel upgrade works with the fix above.