BackupPC & pre/post-restore-[config | data]

NethServer Version: 7.6.1810
Module: BackupPC from Stephdl wiki page updated to Backup-4.3.0

Hi all,

All is working well but I have some questions about pre/post-restore-[config | data].

  • I am restoring from the CLI on the BackuPC host server.
    - The tar file excludes: /etc/sysconfig/network-scripts, /boot and /etc/fstab
  1. I send the key to remote
  2. I send pre-restore-config and check if it had success.
  3. I send pre-restore-data and check if it had success.
  4. I send command to remote to cd to / and to untar:
    command used: ssh -p nnnn root@DESTINATION-ip “cd / && /bin/tar -xvv” < source.tar
  5. At the end of the tar file, I receive the message: /bin/tar: Exiting with failure status due to previous errors.
    If tar exit with that error, I loose ssh connection with DESTINATION as it now uses the SOURCE ssh key instead of the original DESTINATION ssh key used before the restoration.
  6. On the DESTINATION server console:
    - /sbin/e-smith/signal-event post-restore-config
    - /sbin/e-smith/signal-event post-restore-data
    - /sbin/e-smith/signal-event nethserver-ntp-update
    (because without that command, the time is the same as the SOURCE tar file time and DESTINATION server will generate sync command to get to the exact time)
    - /usr/sbin/reboot

When the server comes back from the boot, all is exactly like the SOURCE server with the Let’s Encrypt certificate, web sites, etc… All is working correctly.

Before restore:
Do I need to send pre-restore-config and pre-restore-data?
- It looks like pre-restore-config doesn’t do nothing. Also, without having at least one backup-config you cannot use this command.
- No problem at all with pre-restore-data.

After restoration:
Do I need to use post-restore-config --no-reinstall to disable package reinstall during restore?

One shot command
- Is there a way to send all the commands in one shot to DESTINATION from the CLI of the BackupPC?
That way I won’t have to use the DESTINATION server console which sometime might be unavailable if in a remote site.

Something like this:

ssh -p nnnn root@DESTINATION-IP \
"cd / && /bin/tar -xvv; \
/sbin/e-smith/signal-event post-restore-config; \
/sbin/e-smith/signal-event post-restore-data;\
/sbin/e-smith/signal-event nethserver-ntp-update; \
/usr/sbin/reboot; \
" < source.tar

For that one shot command, I will have to solve the tar error message…

All suggestions appreciated,


Hi all,

News from some more tests.

No need for pre/post-restore-[config | data],
I only used: /sbin/e-smith/restore-config --no-reinstall

  1. ssh -p nnnn root@DESTINATION-IP "cd / && /bin/tar -xv" < source.tar
    I ignore TAR error.
  2. PuTTY reconnect to DESTINATION-IP
  3. /sbin/e-smith/restore-config --no-reinstall
    (This command restored the address to the original one used by SOURCE.
    Wait for the pop-up “Network error: Software caused connection abort.”)
  4. PuTTY reconnect to DESTINATION but with SOURCE address.
  5. Give a reboot command through the PuTTY connection.
  6. PuTTY reconnect to DESTINATION using again SOURCE address.
  7. /sbin/e-smith/signal-event nethserver-ntp-update
  8. VoilĂ ! DESTINATION is exactly a clone of Source.
  9. To resolve update difficulties:
    - yum -y install jq
    - yum -y --enablerepo=nethserver-updates clean metadata
    - yum update -y

Total victory!


1 Like