Thoughts, notes & the occasional opinion.

Tag: Backup

Configuring urBackup Client on Linux

Configuring urBackup client on Linux is done via the shell (surprise!) but it is quick and easy once you know where to start.

To avoid diving into urBackup’s dense administration manual, these are my quick tips for configuring urBackup client in Linux. All the examples below were tested using urBackup client v2.5.26.0 running on Ubuntu 24.04.3 LTS.

Where to start?

Outside of installation and removal, urBackup client is managed through the command line utility urbackupclientctl. Through this utility you may get configure backup paths, get the current status, start (not recommended) and restore from backups.

View Available Commands

To view available commands, simply enter urbackupclientctrl in shell. The output will be something like this:

USAGE:

urbackupclientctl [--help] [--version] <command> [<args>]

Get specific command help with urbackupclientctl <command> --help

urbackupclientctl start
Start an incremental/full image/file backup

urbackupclientctl status
Get current backup status

urbackupclientctl browse
Browse backups and files/folders in backups

urbackupclientctl restore-start
Restore files/folders from backup

urbackupclientctl set-settings
Set backup settings

urbackupclientctl reset-keep
Reset keeping files during incremental backups

urbackupclientctl add-backupdir
Add new directory to backup set

urbackupclientctl list-backupdirs
List directories that are being backed up

urbackupclientctl remove-backupdir
Remove directory from backup set

Current Client Status

To get the current status of the client, use urbackupclient status.

This will return the current status in JSON format. The most useful information is at the end, namely whether the client is connected to the server (property = internet_connected ), the current connection status (property internet_status) and the configured backup server (property = name).

In the example below, the client is successfully connected to the urBackup server found at the address urbackup.server.address

{
"capability_bits": 69696,
"finished_processes": [{
"process_id": 21,
"success": true
}
...
,{
"process_id": 40,
"success": true
}
],
"internet_connected": true,
"internet_status": "connected",
"last_backup_time": 1761566072,
"running_processes": [],
"servers": [{
"internet_connection": true,
"name": "urbackup.server.address"
}
],
"time_since_last_lan_connection": 3089540882
}

List Backup Directories

To view the current list of directories marked for backup use urbackupclientctrl list-backupdir. In the example below, the directories /etc and /srv will be backed up.

PATH       NAME  FLAGS
---------- ----- ----------------------------------------------
/srv srv follow_symlinks,symlinks_optional,share_hashes
/etc etc follow_symlinks,symlinks_optional,share_hashes

Adding a Directory

To add a directory, use urbackupclientctl add-backupdir -d /path/to/directory

To add the directory /home/myuser directory to backups, the command is:

urbackupclientctl add-backupdir -d /home/myuser

CAUTION: At the time of writing, urbackupclientctl does not check if the target directory exists. If you enter an non-existent path, you are likely to get backup errors.

Removing a Directory

Removing a directory is simple: rbackupclientctl remove-backupdir -d /path/to/directory

To remove the directory /home/myuser from backups, the command is:

urbackupclientctl remove-backupdir -d /home/myuser

Starting a Backup

Top Tip: I strongly recommend always starting manual backups via the urBackup Server web administration.

To manually start a backup from the client, use urbackupclientctl start

MySQL Powershell Backup Script

This is easily one of my most commonly used Powershell scripts, and a variation on it runs on my servers at least once a day. It is essentially a very simple script: it contacts a specified MySQL server and then generates a .SQL backup files for each database found. It prefixes each backup filename with the day name (monday, tuesday etc.) so if you run it on daily basis, it gives you a seven day backup rotation for your databases.

As always, the use of this script and the accompanying files is done entirely at your own risk. No guarantee either direct or indirect is implied regarding the security, stability, reliability, impact or performance of this script.

The zip file includes copies of mysqldump.exe and mysql.data.dll that you may require. For details on how to configure and use the script, please see below.

Download the script (ZIP file)

Configuration

There are a few items you will need to configure before you can use the script in anger. All of the configuration options are presented at the top of the script, so you don’t need to delve into the main chunk of code.

Backup Store Folder

This is where the MySQL backup files will be placed. Please enter the path here, but do not include any trailing ‘\’

MySQL User Account

You will require a MySQL user account that has SHOW DATABASES, SELECT, LOCK TABLES and RELOAD permissions. It is also highly advised – especially if performing backups from a remote machine – that this user’s permissions are also limit to readonly.

mysqldump Path

mysqldump is the application that actually creates the backup file. It is typically installed with MySQL, but if you are running the script remotely or don’t know the file’s location, mysqldump.exe is included in the ZIP file.

MySQL .Net Connector

The script requires the MySQL .Net Connector driver. This can either be installed, or you can directly load the DLL file.

Using the connector

  1. Download and install the connector from http://dev.mysql.com/downloads/connector/net/
  2. Uncomment Line 38 of the script. This should say system.reflection.assembly]::LoadWithPartialName(“MySql.Data”)
Loading the library directly (the default method)
If you don’t wish to install the .Net driver, you can directly load the DLL file instead. The required DLL file is included as part of the ZIP file.
  1. Uncomment line 43 of the script. This should say Add-Type -Path “C:\Data\Backups\MySQL\MySql.Data.dll”
  2. Amend the path of line 43 to point to the location of the DLL file

Running the script

You can either run the script manually (through Powershell), or automate it through Task Scheduler. To make life a little easier I tend to create a batch file containing the Powershell command and then invoke the batch file through the task scheduler.

The general format of the command to include in the batch file is

%windir%\System32\WindowsPowerShell\v1.0\powershell.exe “c:\backups\Generic7DayBackup.ps1”

Lastly…

This is by design a very simple script. If you have any suggestions on how to improve it, please let me know by posting a comment.

 

© 2025 Alexander John

Theme by Anders NorĂ©nUp ↑