- Products
- Learn
- Local User Groups
- Partners
- More
The Great Exposure Reset
24 February 2026 @ 5pm CET / 11am EST
CheckMates Fest 2026
Watch Now!AI Security Masters
Hacking with AI: The Dark Side of Innovation
CheckMates Go:
CheckMates Fest
Hi Checkmates
I've been tasked with taking a migrate export once a week from several of our SMS devices in the Azure and copying it to a share.Is it possible to script and schedule this operation.
Cheers
Thanks PhoneBoy, I created the bash script (using Gemini as help by the way) and it worked perfectly. If it helps to anybody this is the complete script, including SCP transfer to server and deletion of files older than 15 days:
#!/bin/bash
# variables
DATE=$(date +%d-%m-%Y)
RUTA_EXPORT="/var/log/backups"
FILE_NAME="Export_server_-$DATE.tgz"
COMPLETE_PATH="$RUTA_EXPORT/$FILE_NAME"
RUTA_SCRIPT_CP="/opt/CPsuite-R81.20/fw1/scripts/migrate_server"
# SCPCP
USER_SCP="user"
SERVER_SCP="1.2.3.4"
RUTA_REMOTA_SCP="/c:/backups"
PASSWORD_SCP="password"
# OLD_DAYS
DAYS_OLD=15
# CP environment
source /etc/profile.d/CP.sh
# export command
"$RUTA_SCRIPT_CP" export -v R81.20 --ignore_warnings "$COMPLETE_PATH" -n
# Verificar si la exportación fue exitosa
if [ $? -eq 0 ]; then
echo "Exportación del servidor completada exitosamente."
# Enviar el fichero por SCP
echo "Enviando el fichero $COMPLETE_PATH a $USER_SCP@$SERVER_SCP:$RUTA_REMOTA_SCP..."
sshpass -p "$PASSWORD_SCP" scp "$COMPLETE_PATH" "$USER_SCP@$SERVER_SCP:$RUTA_REMOTA_SCP"
# Verificar si el envío por SCP fue exitoso
if [ $? -eq 0 ]; then
echo "El fichero $FILE_NAME se ha enviado correctamente a $SERVER_SCP:$RUTA_REMOTA_SCP"
# Borrar ficheros antiguos
echo "Buscando y borrando ficheros con más de $DAYS_OLD días en $RUTA_EXPORT..."
find "$RUTA_EXPORT" -type f -name "Export_server_*" -mtime +"$DAYS_OLD" -delete
if [ $? -eq 0 ]; then
echo "Se han borrado los ficheros antiguos exitosamente."
else
echo "Advertencia: Podría haber habido problemas al borrar los ficheros antiguos."
fi
else
echo "Error al enviar el fichero $FILE_NAME por SCP."
fi
else
echo "Error durante la exportación del servidor."
fi
exit 0
You can call $FWDIR/bin/upgrade_tools/migrate from a script, but the export file is written locally. You will need a second script to do the file transfer later.
If you use GAiA WebGUI System Management > Job Scheduler, define three jobs: One with the migrate export command, a second for the file transfer and a third for deleting the export file.
Thanks. IM pretty new to scripting do you hvae any examples?
Cheers
I built this script which handles the creation and deletion of the exports. It doesn't currently handle copying the file off, because I didn't have a key-based SSH server handy at the time, but that part is the easiest to automate.
Edited to add: To clarify, that exact script is for mds_backup files. It should be pretty easy to modify for migrate export on a SmartCenter. You would need to change the "Run the backup" section, the *.mdsbk.* part in the SCP section and the "If the SCP worked" section, and the subject and body in the emails at the beginning and end. The file rotation logic is sound.
Hi,
If I understand correctly, DH_ND is trying to run a frequent 'migrate export'.
And to my knowledge, there is always a cpstop/mdsstop required. And of course the start of the services again. Which creates always an unavailability of MGMT. Other admins can't connect or are being disconnected.
Depending on the requirement, backup/mds_backup might be a good alternative.
Regards
Hi S_E_
Yes thats correct. These will be run during the night so unless we are experiencing issues then other admins won't be on. If services need to be started we can always use the console thorugh Azure.
Cheers
Hi,
We are trying to use job scheduler for creating migrate export, but it is not working. We are using the below configuration.
add cron job Config_Backup command "/opt/CPsuite-R81/fw1/bin/upgrade_tools/migrate export /var/log/MigrateExport/Mgmt_Backup -n" recurrence daily time 21:40
could you please confirm if we have to consider anything to make it working.
If you are using a relatively new version, you should probably be using the new API / management CLI command for migrate export:
https://sc1.checkpoint.com/documents/latest/APIs/#cli/migrate-export-domain~v1.8%20
Thanks for the details. I have even tried like below and it is working.
add cron job Config_Backup command "source /etc/profile.d/CP.sh ; /opt/CPsuite-R81/fw1/bin/upgrade_tools/migrate export /var/log/MigrateExport/Mgmt_Backup -n" recurrence daily time 21:40
Hi
I am trying to replicate your solution but it's not working for me, I think that is because I am using variables in the file name, this is my command:
add cron job backup command "source /etc/profile.d/CP.sh ; /opt/CPsuite-R81.20/fw1/scripts/migrate_server export -v R81.20 --ignore_warnings /var/log/backups/Export_server_-$(date +"%d-%m-%Y").tgz -n" recurrence daily time 18:18
The command "/opt/CPsuite-R81.20/fw1/scripts/migrate_server export -v R81.20 --ignore_warnings /var/log/backups/Export_server_-$(date +"%d-%m-%Y").tgz -n" works perfectly on CLI, so it is not a syntax problem,
If I remove the "$(date +"%d-%m-%Y")" part the command is accepted by cron, both in CLI and Gaia GUI. Does anyone know how to indicate these variables in the command?
Thanks.
When called from cron, the command is executed with sh (Bourne Shell), which does not support shell expansions like $(date +"%d-%m-%Y").
The fix for this would be to put this command in a bash script, which would be called by cron instead.
Thanks PhoneBoy, I created the bash script (using Gemini as help by the way) and it worked perfectly. If it helps to anybody this is the complete script, including SCP transfer to server and deletion of files older than 15 days:
#!/bin/bash
# variables
DATE=$(date +%d-%m-%Y)
RUTA_EXPORT="/var/log/backups"
FILE_NAME="Export_server_-$DATE.tgz"
COMPLETE_PATH="$RUTA_EXPORT/$FILE_NAME"
RUTA_SCRIPT_CP="/opt/CPsuite-R81.20/fw1/scripts/migrate_server"
# SCPCP
USER_SCP="user"
SERVER_SCP="1.2.3.4"
RUTA_REMOTA_SCP="/c:/backups"
PASSWORD_SCP="password"
# OLD_DAYS
DAYS_OLD=15
# CP environment
source /etc/profile.d/CP.sh
# export command
"$RUTA_SCRIPT_CP" export -v R81.20 --ignore_warnings "$COMPLETE_PATH" -n
# Verificar si la exportación fue exitosa
if [ $? -eq 0 ]; then
echo "Exportación del servidor completada exitosamente."
# Enviar el fichero por SCP
echo "Enviando el fichero $COMPLETE_PATH a $USER_SCP@$SERVER_SCP:$RUTA_REMOTA_SCP..."
sshpass -p "$PASSWORD_SCP" scp "$COMPLETE_PATH" "$USER_SCP@$SERVER_SCP:$RUTA_REMOTA_SCP"
# Verificar si el envío por SCP fue exitoso
if [ $? -eq 0 ]; then
echo "El fichero $FILE_NAME se ha enviado correctamente a $SERVER_SCP:$RUTA_REMOTA_SCP"
# Borrar ficheros antiguos
echo "Buscando y borrando ficheros con más de $DAYS_OLD días en $RUTA_EXPORT..."
find "$RUTA_EXPORT" -type f -name "Export_server_*" -mtime +"$DAYS_OLD" -delete
if [ $? -eq 0 ]; then
echo "Se han borrado los ficheros antiguos exitosamente."
else
echo "Advertencia: Podría haber habido problemas al borrar los ficheros antiguos."
fi
else
echo "Error al enviar el fichero $FILE_NAME por SCP."
fi
else
echo "Error durante la exportación del servidor."
fi
exit 0
Leaderboard
Epsum factorial non deposit quid pro quo hic escorol.
| User | Count |
|---|---|
| 4 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |
Thu 19 Feb 2026 @ 03:00 PM (EST)
Americas Deep Dive: Check Point Management API Best PracticesMon 23 Feb 2026 @ 11:00 AM (EST)
Latest updates on Quantum Spark including R82 features and Spark Management zero touch - AMERTue 24 Feb 2026 @ 10:00 AM (CET)
Latest updates on Quantum Spark including R82 features and Spark Management zero touch - EMEAThu 19 Feb 2026 @ 03:00 PM (EST)
Americas Deep Dive: Check Point Management API Best PracticesMon 23 Feb 2026 @ 11:00 AM (EST)
Latest updates on Quantum Spark including R82 features and Spark Management zero touch - AMERTue 24 Feb 2026 @ 10:00 AM (CET)
Latest updates on Quantum Spark including R82 features and Spark Management zero touch - EMEAAbout CheckMates
Learn Check Point
Advanced Learning
YOU DESERVE THE BEST SECURITY