OS - Raspberry Pi OS Bookworm 64 Bit
Device - Raspberry Pi 5 4GB
urbackup installed via the .deb package available on the official site.
How auto shutdown works - UrBackup creates a file called shutdown_now in /var/urbackup if it recognises it has been idle for some time. (My calculation shows this time interval to be around 30 min).
A systemd service file that is enabled at boot checks for this file and if found deletes the file, then executes a shutdown in 5 minutes.
Issue - UrBackup seems to create this file every minute. So if my script finds shutdown_now and deletes it and schedules a shutdown in 5 minutes, urbackup creates this file 5 times again in that interval. This is not an issue in the current cycle, however when the system is booted again, since the file exists in that location, the service file executes another shutdown. Unless this is caught by the user and cancelled, this will lead to a wrong shutdown. Another quirk here is that when the user accesses the /var/urbackup folder after a shutdown, I am unable to see the shutdown_now file. This means that some time between the service finding the file after boot and login, urbackup deletes this file.
Possible Solution -
- UrBackup server creates shutdown_now only once. The systemd service finds it, removes the file and executes the shutdown. On next boot, no file is found and no shutdown is scheduled.
- The systemd service file becomes active only after login. This might give the UrBackup server time to delete the shutdown_now file created in the last boot.
- Use shutdown now instead of 5m time delay. This is the least preferred solution as I have other services running that I would like to do certain things once a shutdown is scheduled. There is also the risk that if for some reason the service file is executed but shutdown is delayed by another service and urbackup is still active, this might cause the file to be created again and the next time it boots, it will detect the file and shutdown immediately. In other words, it’ll result in a boot loop.
Now I have 2 questions,
- Is there a reason why UrBackup Server creates this file every minute?
- How does UrBackup Server determine the system is idle?
As for the feature request, I’d like to be able to set the time delay that is considered as Idle before UrBackup generates the shutdown_now file.
@uroni - Please take a look at this if possible.