Hi all,
to reboot Pihole im going to login via ssh and sudo reboot.
Is there an option to do that daily automatically?
For example: Every morning 5 o clock
Thanks in advance!
Hi all,
to reboot Pihole im going to login via ssh and sudo reboot.
Is there an option to do that daily automatically?
For example: Every morning 5 o clock
Thanks in advance!
Yes, you can set up a cron job to do that.
Why would you need to though? My Pi only gets restarted after an OS update.
Yes, cronjob works. Tested few minutes ago ...
I daily updated Lists at 04.30 and restart at 5 o clock. Thanks.
If the goal is to reboot after updates you can tweak unattended upgrades to only reboot when needed, no need for cronjob. See the link for a serverfault discussion on it.
Without knowing your actual intent, I'll just add that unatteneded upgrades is usually best for security updates. If thats how your setup then you will obviously still need to check for normal updates. Unattended upgrades also doesn't check for updates on the RaspberryPi OS. Lastly, I also find it nice to have unattended upgrades mail the pi user after competiton just to see if it was successful or not ( requires installing mailx if I recall correctly).
Added comment: Another reason to consider rebooting with unattended upgrade over a cron job is that while you set a time for the unattended upgrades it may not start at that exact time. This means that you may find the cron job rebooting your system during the update / upgrade. You can view the times it actually ran using the following:
sudo cat /var/log/unattended-upgrades/unattended-upgrades.log |grep -i starting
An example from my looks show 40-50 minute differences in actual start times.
2024-11-01 06:47:50,525 INFO Starting unattended upgrades script
2024-11-02 06:04:09,644 INFO Starting unattended upgrades script
2024-11-03 06:05:19,103 INFO Starting unattended upgrades script
2024-11-04 06:22:39,020 INFO Starting unattended upgrades script
2024-11-05 06:25:49,833 INFO Starting unattended upgrades script
2024-11-06 06:36:50,643 INFO Starting unattended upgrades script
2024-11-07 06:46:50,366 INFO Starting unattended upgrades script
2024-11-08 06:30:48,174 INFO Starting unattended upgrades script
2024-11-09 06:41:16,251 INFO Starting unattended upgrades script
2024-11-10 06:02:16,254 INFO Starting unattended upgrades script
2024-11-11 06:44:03,868 INFO Starting unattended upgrades script
2024-11-12 06:01:58,496 INFO Starting unattended upgrades script
2024-11-13 06:10:01,567 INFO Starting unattended upgrades script
2024-11-14 06:08:16,976 INFO Starting unattended upgrades script
If you use the cron job you should consider either adjusting the time unattended upgrades run ( run it earlier ) or run the cron job later.
Sometimes (1x per month approx) i get 500 internal server error (Admin Page). But it still works.
I update every daily 04.30 my adlists and want to restart the Pi every day.
IN addition to that i added unattended updates too.
For me perfect.
Thanks! My one:
2024-11-13 13:51:02,095 INFO Starting unattended upgrades script
2024-11-14 00:09:29,417 INFO Starting unattended upgrades script
2024-11-14 06:26:16,785 INFO Starting unattended upgrades script
2024-11-15 03:12:02,181 INFO Starting unattended upgrades script
2024-11-15 06:03:49,847 INFO Starting unattended upgrades script
What do you think? Should i go to another time?
Your times seems to vary by quite a bit ( 13:51, 00:09, 06:26 etc ). I'm not sure how you would be sure it wouldn't reboot at an inconvient time. You could try to override systemds time it runs the update to make sure its running when you want ( see this link ).
THX, puh for me not easy to make the correct commands to make updates at the daily same time.
pi@raspberrypi:~ $ sudo apt-get upgrade
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Calculating upgrade... Done
The following packages will be upgraded:
raspi-config
1 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Need to get 36.2 kB of archives.
After this operation, 0 B of additional disk space will be used.
Do you want to continue? [Y/n] n
Abort.
pi@raspberrypi:~ $ sudo cat /var/log/unattended-upgrades/unattended-upgrades.log |grep -i starting
2024-11-16 11:03:48,350 INFO Starting unattended upgrades script
2024-11-17 05:00:57,945 INFO Starting unattended upgrades script
2024-11-17 05:30:42,320 INFO Starting unattended upgrades script
2024-11-18 05:00:47,966 INFO Starting unattended upgrades script
2024-11-18 05:30:32,460 INFO Starting unattended upgrades script
2024-11-19 05:00:25,855 INFO Starting unattended upgrades script
2024-11-19 05:30:19,956 INFO Starting unattended upgrades script
2024-11-20 05:01:02,475 INFO Starting unattended upgrades script
2024-11-20 05:30:44,387 INFO Starting unattended upgrades script
2024-11-21 05:00:41,363 INFO Starting unattended upgrades script
2024-11-21 05:30:23,071 INFO Starting unattended upgrades script
pi@raspberrypi:~ $ sudo systemctl status apt-daily.timer
â—Ź apt-daily.timer - Daily apt download activities
Loaded: loaded (/lib/systemd/system/apt-daily.timer; enabled; preset: enabled)
Drop-In: /etc/systemd/system/apt-daily.timer.d
└─override.conf
Active: active (waiting) since Thu 2024-11-21 04:45:05 CET; 3h 26min ago
Trigger: Fri 2024-11-22 05:00:00 CET; 20h left
Triggers: â—Ź apt-daily.service
Nov 21 04:45:05 raspberrypi systemd[1]: Started apt-daily.timer - Daily apt download activities.
pi@raspberrypi:~ $ sudo systemctl status apt-daily-upgrade.timer
â—Ź apt-daily-upgrade.timer - Daily apt upgrade and clean activities
Loaded: loaded (/lib/systemd/system/apt-daily-upgrade.timer; enabled; preset: enabled)
Drop-In: /etc/systemd/system/apt-daily-upgrade.timer.d
└─override.conf
Active: active (waiting) since Thu 2024-11-21 04:45:05 CET; 3h 26min ago
Trigger: Fri 2024-11-22 05:30:00 CET; 21h left
Triggers: â—Ź apt-daily-upgrade.service
Nov 21 04:45:05 raspberrypi systemd[1]: Started apt-daily-upgrade.timer - Daily apt upgrade and clean activities.
pi@raspberrypi:~ $
Does anybody know, why the upgrade wasn´t installed by the daily upgrade service? (This update was yesterday available and has to be installed by the script at 5:30 am.)
This isn't related to Pi-hole:
You are rebooting your OS, not Pi-hole.
What's more, Pi-hole does not require your OS to reboot daily, e.g. mine has been running without one for months now:
~$ uptime
08:52:46 up 129 days, 19:51, 1 user, load average: 0.00, 0.00, 0.00
For advice on upgrading your OS, you should consider to also consult your OS's documentation and support forums.
i get sometimes 500 Server Error after Upgrade Adlists. I have to reboot the system.
By default, Pi-hole would upgrade gravity once a week, and that wouldn't involve Pi-hole's web server.
Yet 500 is an HTTP status code generated by a webserver, i.e. it wouldn't indicate that Pi-hole's DNS service is inoperational.
As 500 codes may be intermediary, and as only the webserver is affected, you should try to refresh the page, or just restart your webserver if the 500 sticks.
If you are you seeing a 500 after initiating a gravity update via Pi-hole's UI, and you would like to further investigate that with us, you should open a new topic with the necessary details.
This is normal. Unattended upgrades does a pattern search of apt-cache policy
to see what it should upgrade based on its config file. Raspberry pi repositories are not part of the standard Unattended Upgrades so it doesn't see it.
Is there a option to add files like this ?
I assume you could try and modify the config file located at /etc/apt/apt.conf.d/50unattended-upgrades but I've not tried it and not something I would recommend ( I'm a firm believer that unattended upgrades is best used for security related updates).
Information regarding configuring, and using unattended upgrades, should you decide that is what you want, is probably better served elsewhere, as it really is not Pi-hole related. Pi-hole generally manages itself quite well.
I think thats is why the OP posted in the general / off topic section.....
This is the problem you should address. Rebooting just papers over a problem.