[dupe]Auto Update

I am very new to Linux and have been learning about as much as I can. I love dietpi and have been using it on my ODROID XU4. I still have normal Rasbian on my Pi2 though.

On my pi I use cron-apt and found that dietpi has something similar already built in. dietpi-cron. In searching I found /etc/cron.daily/apt which has a lot of what I think I need in it already.

I need a way to make my device run 4 commands at 4 different times. How would I achieve this?

The commands and times I need are as follows.

1am - sudo apt-get update
2am - sudo apt-get upgrade --y
3am - sudo apt-get dist-upgrade --y
4am - sudo reboot

4 commands that I would like to run. If they have to run 1 after the other that works as well just not all at the same time for obvious reasons.

I saw some lines of code in the apt file that looked like those commands but de-activated but I have no idea how to read ANY code let alone re-write it. I have very basic understanding have have only gotten as far as I have through 50+ hours of reinstall and retry keeping logs of correct commands so by the end the entire process is written down. Every mistake I restarted. Slow going but in the end everything is smooth. Now this is just something to smooth that out.

bump.

All I want is a way to update, upgrade and reboot once done every day at 3am. Can anyone help with that?

cd ..

sudo mkdir home

cd ../home

sudo mkdir jb

cd jb

sudo mkdir scripts

cd scripts



sudo nano /home/jb/scripts/update



#!/bin/bash
apt-get update ; apt-get -y upgrade ; apt-get -y dist-upgrade ; apt-get clean ; apt-get -y autoremove ; reboot



sudo crontab -e

0 3 * * * sudo bash /home/jb/scripts/update

Dupe of: https://dietpi.com/forum/t/auto-update/1115/1