Hi,
As i didn't find anything using google, i made a script that could be use in order to schedule an upgrade export (each week for example), and backup files to an ftp server :
Those variables must be change; adjust according to your Checkpoint and FTP configuration :
- Create the script export.sh into /usr/local/bin folder :
Paste this content into export.sh (don't forget to adapt:
Code:
#!/bin/bash -f
source /etc/profile.d/CP.sh
#VARIABLES
DATE=`date +%Y%m%d`
FILE=$HOSTNAME"_"$DATE"_export"
FOLDER=$FWDIR/bin/upgrade_tools/
echo ******Process Migrate Export `date +'%d.%m.%y %H:%M:%S'` STARTED******
echo Migrate export $FILE started
#UPGRADE_EXPORT
echo File will be $FOLDER$FILE.tgz
$FWDIR/bin/upgrade_tools/migrate export -n $FOLDER/$FILE
echo Migrate export $FILE finished
#Waiting for migrate export to finished
echo waiting 2 minutes
sleep 2m
echo waiting finished
echo FTP $FILE started
#FTP
cd $FOLDER
HOST=HOST
USER=USER
PASSWD=PASSWD
ftp -n $HOST <<END_SCRIPT
quote USER $USER
quote PASS $PASSWD
bin
put $FILE.tgz
quit
END_SCRIPT
echo FTP $FILE finished
#REMOVE
echo Remove of $FOLDER/$FILE.tgz started
rm $FWDIR/bin/upgrade_tools/$FILE.tgz
echo Remove of $FOLDER/$FILE.tgz finished
echo ******Process Migrate export `date +'%d.%m.%y %H:%M:%S'` FINISHED******
exit
#Script written by Sebastien GUILMER
- Make the script executable :
chmod +x export.sh
crontab –e
- Paste the line (don't forget to adapt) :
* * * * 0 /usr/local/bin/export.sh >> /usr/local/bin/CRONexport.txt
The script running without error give that :
Code:
[Expert@Mgmt:0]# ./export.sh
******Process Migrate Export 09.05.14 14:22:26 STARTED******
Migrate export Mgmt_20140509_export started
File will be /opt/CPsuite-R77/fw1/bin/upgrade_tools/Mgmt_20140509_export.tgz
Migrate export Mgmt_20140509_export finished
waiting 2 minutes...
waiting finished
FTP Mgmt_20140509_export started
FTP Mgmt_20140509_export finished
Remove of /opt/CPsuite-R77/fw1/bin/upgrade_tools//Mgmt_20140509_export.tgz started
Remove of /opt/CPsuite-R77/fw1/bin/upgrade_tools//Mgmt_20140509_export.tgz finished
******Process Migrate export 09.05.14 14:23:28 FINISHED******
[Expert@Mgmt:0]#
Try this in lab before deploying in production !
Best regards,
Sébastien G
Bookmarks