A
A
Alexander Zakharov2020-04-30 14:05:31
linux
Alexander Zakharov, 2020-04-30 14:05:31

How can I organize a reboot of a linux system (debian in particular) by uptime?

Tell me how to correctly implement a system reboot by uptime? Those. so that the system reboots, say, every week after launch.
My idea is to write a bash script that will run by cron at a certain time every day, check if the week has passed through uptime and, if the condition is met, reboot the system.
Maybe someone knows a simpler solution?

Answer the question

In order to leave comments, you need to log in

4 answer(s)
P
pfg21, 2020-04-30
@pfg21

https://www.freedesktop.org/software/systemd/man/s...
OnBootSec=604800

X
xmoonlight, 2020-04-30
@xmoonlight

cron?)

A
Adamos, 2020-04-30
@Adamos

man shutdown

A
Alexey, 2020-05-01
@AlexeyKolodchenko

Why fence a garden? Do a cron reboot every seventh or fourteenth day at 2:00. Why do you need uptime? Or do you think that in two weeks it may be different?
By the way, such a question, why did such a need arise: to restart the computer by uptime? Maybe in your case you can do without a reboot?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question