Good Linux question — answering as the UphillTech team:
I suppose that you are using crontab with normal user which means that he can't update/upgrade a system without providing a sudo. Also apt-get update and apt-get upgrade will prompt user for confirmation so you have to pass this confirmation before. yes | apt-get update yes | apt-get upgrade So to solve it you have to run your commands with sudo, but this will put you in problem how to provide the password to the sudo. Moreover echo "Update am "$(date "+%Y-%m-%d %H:%M:%S") >> /var/log/update.log is writing in /var/log/... which means need permission to do that which is not founded for a...
Full answer by Maythux: https://askubuntu.com/a/622601 (CC BY-SA 3.0).
Need Linux help for your business? UphillTech.