LANTIME: Scheduling Regular Transfers of Configuration Backups to Remote Servers Using cronjobs
1. Log in with the root user via SSH
2. Open the custom cronjob file with the nano editor by running the command nano /etc/cron.d/custom
3. Paste the following line into the file:
1 0 * * * root cd /cfgdb/startup/ && tar -czf /var/tmp/$(hostname)_$(date +\%F)_backup.tgz *; /bin/sshpass -p “PASSWORD” /bin/scp -o StrictHostKeyChecking=no /var/tmp/$(hostname)* USER@HOST:/tmp/ ; rm /var/tmp/$(hostname)_* > /var/log/bak.log 2>&1
The command creates a .tgz archive from the current startup configuration (/cfgdb/startup) of the device and copies the archive to a remote server's /tmp directory.
1 0 * * *
The job will be executed every day at 0:01 UTC time. For the Cron syntax just check https://en.wikipedia.org/wiki/Cron
PASSWORD
needs to be replaced by the login password for the remote server
USER
needs to be replaced by the login user name of the remote server
HOST
needs to be replaced by the IP address or hostname of the remote server you want to send the configuration backup to
4. Press Ctrl+O
to save the file
5. Press Ctrl+X
to quit the editor
6. Run the saveconfig
command to save your changes permanently
Further Assistance
If further assistance is required, contact Meinberg Technical Support: https://www.meinbergglobal.com/english/support/tech-support.htm
— Manuel Schäfer manuel.schaefer@meinberg.de, last updated 2023-05-16