Check if backup is running on CLI

Hi,

is there a way to check urbackupsrv if a backup is currently running on CLI (linux)? I want to check this to do a custom cleanup script which deletes obsolete zfs datasets by running urbackupsrv remove-unknown and fetch the datasets on stderr which can’t be deleted by urbackupsrv cleanup.

Cheers

Knut

1 Like

Solved by myself:

netstat -tp | grep 'urbackupsrv' | grep '35621'

This only works with file backups. On image backup you have to look at the additional connections per host on port 35623.

Thanks. I was looking for this.
I am using Autosuspend linux package to suspend the server if its idle for some time.
How to integrate this with Autosuspend Activity Check?
I want to prevent suspend if an image backup is running

See UrBackup - Server administration manual , maybe that is enough?

8.1.5 Automatically shut down server

If you check this UrBackup will try to shut down the server if it has been idle for some time. This also causes too old backups to be deleted when UrBackup is started up instead of in a nightly job.
In the Windows server version this works without additional work as the UrBackup server process runs as a SYSTEM user which can shut down the machine. On Linux the UrBackup server runs as a limited user which normally does not have the right to shut down the machine. UrBackup instead creates the file ’/var/urbackup/shutdown_now’, which you can check for existence in a cron script e.g.:
if test -e /var/urbackup/shutdown_now
then
shutdown -h +10
fi

Default: Not checked.

1 Like

You can use URBSTAT tool:

urbstat current-activities

In your script you would probably want to check if that is greater than 0:

urbstat current-activities --format number

It will check for all server activities - backups, cleanup etc.

Will this work if UrBackup server is inside docker container?

If you can access the web interface then it will work just fine, for example from your workstation.

ok. cool