Manage backup jobs, destiantions, exclude lists, restore, etc.
To list all current backup jobs run command:
opencli backup-job list
opencli backup-job create
opencli backup-job edit
opencli backup-run <ID> --force-run
opencli backup-job delete <ID>
To list all current destinations run command:
opencli backup-destination list
Example output:
Available destination IDs:
2143
2145
2142
2144
2141
To create a new destination run the following command:
opencli backup-destination create <HOSTNAME> <PASSWORD_FOR_KEY_FILE> <PORT> <USER> <PATH_TO_SSH_KEY_FILE> <STORAGE_PERCENTAGE>
Example:
opencli backup-destination create 15.19.90.29 strongpass 22 root /root/.ssh/id_rsa 85
To edit destination configuration run the following command:
opencli backup-destination edit <ID> <HOSTNAME> <PASSWORD_FOR_KEY_FILE> <PORT> <USER> <PATH_TO_SSH_KEY_FILE> <STORAGE_PERCENTAGE>
Example:
opencli backup-destination edit 241 15.19.90.29 strongpass 22 root /root/.ssh/id_rsa 85
Destination ID: '241' edited successfully!
Previous destination configuration:
{
"hostname": "18.19.90.29",
"password": "pass222",
"ssh_port": 22,
"ssh_user": "new_ssh_user",
"ssh_key_path": "/root/.ssh/id_rsa",
"storage_limit": "100"
}
New destination configuration:
{
"hostname": "15.19.90.29",
"password": "strongpass",
"ssh_port": 22,
"ssh_user": "root",
"ssh_key_path": "/root/.ssh/id_rsa",
"storage_limit": "85"
}
To delete a destination run the following command:
opencli backup-destination delete <ID>
:::tip Destination can not be deleted if it is used by any backup job. :::
To validate a destination run the following command:
opencli backup-destination validate <ID>
Command will test;
Examples:
opencli backup-destination validate 2144
Validating SSH connection with the destination, running command: 'ssh -i /root/.ssh/id_rsa root@18.19.90.29 -p 22'
SSH connection successful.
Destination directory /root/backup on the remote server is owned by root user.
Disk usage on remote destination is over the storage limit (70%) for /root/backup. Backups jobs will not run!
opencli backup-destination validate 2145
Validating SSH connection with the destination, running command: 'ssh -i /root/.ssh/id_rsa root@18.19.90.29 -p 22'
SSH connection successful.
Destination directory /root/backup on the remote server is owned by root user.
Disk space on remote destination is below the storage limit (85%) for /root/backup. Backups can run without a problem.
opencli backup-destination validate 1
Validating SSH connection with the destination, running command: 'ssh -i /root/.ssh/id_rsa root@18.19.90.29 -p 202'
ssh: connect to host 18.19.90.29 port 202: Connection refused
Validation failed! SSH connection failed or timed out.
SSH Connection Status: 255
To restore user files from a backup run command:
opencli backup-restore <DATE> <USER> --all
To restore only specific files from a backup, specify what to restore instead of the --all
flag:
opencli backup-restore <DATE> <USER> [-files --entrypoint --nginx-conf --mysql-conf --mysql-data --php-versions --crontab --user-data --core-users --stats-users --apache-ssl-conf --domain-access-reports --ssh --timezone]
Available options:
--all
- restores all user files.--files
- restores home directory--entrypoint
- restore services and their status--apache-conf
- restore Apache configuration--nginx-conf
- restore Nginx configuration--mysql-conf
- restore MySQL configuration--mysql-data
- restore MySQL databases and users--php-versions
- restore php versions and their php.ini files--crontab
- restore cronjobs--user-data
- restore user password, email address, 2fa settings, preferences..--core-users
- restore OpenPanel data for the user account--stats-users
- restore resource usage statistics for the account--apache-ssl-conf
- restore VirtualHosts and SSL certificates--domain-access-reports
- restore html reports for domain visitors--ssh
- restore SSH users and passwords--timezone
- restore timezone settingopencli backup-list
allows you to view available backups for a single user.
opencli backup-list <USERNAME> [--json]
opencli backup-details
allows you to view information about a specific user backup.
opencli backup-list <USERNAME> <BACKUP_JOB_ID> <DATE> [--json]
Example:
root@server:/# openpanel backup-details nesto 2 20240131170700
backup_job_id=2
destination_id=1
destination_directory=20240131170700
start_time=Wed Jan 31 17:07:52 UTC 2024
end_time=Wed Jan 31 17:09:35 UTC 2024
total_exec_time=103
contains=Full Backup
status=Completed
opencli backup-index
allows you to re-index backups from a remote destination and make them available for users.
opencli backup-index <ID>
Example:
opencli backup-index 21
Indexing backups for 5 users from destination: 18.19.90.29 and directory: /root/backup
Processing user stefan (1/5)
Indexed 6 backups for user stefan.
Processing user demo (2/5)
Indexed 6 backups for user demo.
Processing user demo123 (3/5)
Indexed 6 backups for user demo123.
Processing user pera (4/5)
Indexed 5 backups for user pera.
Processing user nesto (5/5)
Indexed 5 backups for user nesto.
Index complete, found a total of 28 backups for all 5 users.
opencli backup-check
checks process id for any running jobs and terminates the backupjob if process is not running.
opencli backup-check
opencli backup-scheduler
command is executed daily to schedule new backup jobs and ensure they are carried out on time.
Example:
opencli backup-scheduler --debug
0 1 * * SUN opencli backup-run 2 --entrypoint --files --mysql_conf
0 1 * * * opencli backup-run 3 --conf
opencli backup-config
allows you to change general backup settings that affect all backup jobs and destinations.
The get
parameter allows you to view current backup settings.
opencli backup-config get <OPTION>
Example:
# opencli backup-config get time_format
24
The update
parameter allows you to change backuo settings.
opencli backup-config update <OPTION> <NEW-VALUE>
Example:
opencli backup-config update time_format 12
Updated time_format to 12
Currently available backup configuration options: