Crontab help (Raspberry Pi)

  • Thread starter Thread starter Deleted member 651465
  • Start date Start date

Deleted member 651465

Deleted member 651465

I want to use cron to have a monthly upgrade task followed by a reboot.

So far I've put this in the system cron using crontab -e:

Code:
0 4 1 * * apt-get update && apt-get upgrade -y && pihole -up && reboot
@reboot sudo apt-get autoremove && sudo apt-get clean


Where am I going wrong? :(
 
You need to run the tasks as root and then you can remove the sudo in them.

It’s probably not a good idea to automate updates like that either as simple as it may seem if you get rolled an update that breaks things you’ll be non the wiser as to why (Ubiquiti repo updates prime example).

You don’t need to be cutting edge with that kind of stuff, as your updating from repo you’re using stable builds anyway.
 
Running in root.

Sudo su gets me in to root then crontab from there, hence why I’ve taken Sudo out of the commands.

Wrong?

You need to run the tasks as root and then you can remove the sudo in them.

It’s probably not a good idea to automate updates like that either as simple as it may seem if you get rolled an update that breaks things you’ll be non the wiser as to why (Ubiquiti repo updates prime example).

You don’t need to be cutting edge with that kind of stuff, as your updating from repo you’re using stable builds anyway.

This is why I’ve set it to monthly. I wanted something sooner but figured any borked updates would be patched before the update. Unless of course they push an update on 31st of the month :o
 
Back
Top Bottom