- CheckMates
- :
- Products
- :
- Quantum
- :
- Security Gateways
- :
- Scheduled FTP transfer NOT working
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page
Are you a member of CheckMates?
×- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Scheduled FTP transfer NOT working
Hello guys,
I have a small script that's supposed to take a backup of the database (upgrade_export) on my SmartCenter every saturday night and to transfer it to an FTP server. This was working perfectly in R77.30 but since I upgraded to R80.10, it doesn't work anymore. When I run the script manually, the job is correctly done and the database is transfered to the FTP server. But When I schedule it, all the script run until the point where the FTP connection is made and then immediately terminated without transfering the database file.
Do you have any idea why the Cron job doesn't transfer the file to the FTP server. Has anyone already scheduled a script with FTP transfer in R80.10 ?
Thanks a lot guys in advance for your feedback.
Kind regards,
Alain
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
It would be helpful if you could share the script you are using to do this.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Dameon,
Thanks for your feedback. Please find below the script I use to do the backup of the database. Also, I include the clish command that schedules the job.
Regards,
Alain
#!/bin/bash -f
source /opt/CPshrd-R77/tmp/.CPprofile.sh
#VARIABLES
DATE=`date +%Y_%m_%d`
FILE="config_checkpoint_"$HOSTNAME"_"$DATE
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 finish
echo waiting 1 minute
sleep 1m
echo waiting finished
echo FTP $FILE started
#FTP
cd $FOLDER
HOST=<FTP_Server_IP>
USER=<FTP_username>
PASSWD=<FTP_Password>
ftp -n $HOST <<END_SCRIPT
quote USER $USER
quote PASS $PASSWD
bin
cd CheckPoint/BackupDB
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Instead of redirecting the output to a file you need to make sure to use a logfile in the script itself.
Use this command for the cron instead:
add cron job BackupDB command "/usr/local/bin/export.sh >/dev/null 2>&1" recurrence weekly days 6 time 23:15
As the last line you could mail that log file to yourself to see the results of the backup.
The FTP part of our backup script looks like this:
#---------------------------------------------------------
# Send system logfiles to FTP server
#---------------------------------------------------------
echo '--------------------------------------------' >>$LOG
timestamp 'Send system logs to FTP server ... ' >>$LOG
echo '--------------------------------------------' >>$LOG
timestamp 'Starting FTP session ...' >>$LOG
ftp -in 1>/dev/null 2>>$LOG <<_FTP-SYSTEM_
open $FTPSVR
user $FTPUSER $FTPPASS
mkdir /MDS/`uname -n`
cd /MDS/`uname -n`
binary
prompt
lcd $MDS_BCKDIR
mput `date --utc +%e%b%Y`* >>$LOG
quit
timestamp 'Finished FTP session ...' >>$LOG
echo >>$LOG
#---------------------------------------------------------
# End of Script
#---------------------------------------------------------
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Maarten,
I've tested your suggestion but it didn't solve my issue. I could find the root cause of the issue. At the beginning of my script, this line source /opt/CPshrd-R77/tmp/.CPprofile.sh needed to be replaced by this source /opt/CPshrd-R80/tmp/.CPprofile.sh.
Thanks a lot for your input anyway.
Kind regards,
Alain
