Debian Ubuntu Update Script with Switch OFF after update

I f you work on you PC daily Patches must be checked and installed.
At Debian / Ubuntu the Gnome-Update-Manager does this. But there is
NO Shutdown possible after update.

– create Script #sudo nano /root/
add inside:

apt-get update           //for update Patches Database PC
apt-get dist-upgrade -y         //install Patches automatic
apt-get clean      //cleanup PC
/sbin/init 0      //shutdown PC automatic or reboot Server = init 6

You can now after work set it to crontab or start manual by #sudo sh /root/

On Servers name it and set root cron to run the job @hourly/@daily