[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [FW-1] Running Cron job on Secure Platform AI
You need to either define the appropriate environment variables ($FWDIR) or use full path name everywhere. That will solve your problem. Regards, RK >>> [email protected] 10/02/03 11:56AM >>> Hi all, I have an issue trying to run a backup script on NG w/ AI Secure Platform. When the script is run manually (from the shell) and it runs fine. When it is run via cron, it fails. From what I can tell, the environment variables are not active in the context of cron and when the script tries to run backup_start (backup command) it doesn't know where anything is. I've attached the script as well as some errors in various logs. Your help is greatly appreciated. Cheers, Rick Hislop Burntsand Inc. 1500 - 1075 West Georgia Street Vancouver, B.C., V6E 3C9 Tel:Fax:** From /var/log/messages log ** Sep 30 23:59:00 ptcfw1 CROND[21462]: (root) CMD (/etc/init.d/cp_backup.sh) Sep 30 23:59:00 ptcfw1 CronDaemon: Cron <root@ptcfw1> /etc/init.d/cp_backup.sh (Environm ent: <SHELL=/bin/sh>, <HOME=/root>, <PATH=/usr/bin:/bin>, <LOGNAME=root>) : /etc/init.d/ cp_backup.sh: cpstop: command not found Sep 30 23:59:00 ptcfw1 CronDaemon: Stop FW Sep 30 23:59:00 ptcfw1 CronDaemon: /bin/backup_start: /tmp/.CPprofile.sh: No such file o r directory Sep 30 23:59:00 ptcfw1 CronDaemon: Send-Full to <IP address of Log server> Sep 30 23:59:00 ptcfw1 CronDaemon: /etc/init.d/cp_backup.sh: cd: /log: No such file or d irectory Sep 30 23:59:00 ptcfw1 CronDaemon: ./ Sep 30 23:59:00 ptcfw1 CronDaemon: tar: ./-Logs.tar: file is the archive; not dumped Sep 30 23:59:00 ptcfw1 CronDaemon: ./.bash_logout Sep 30 23:59:00 ptcfw1 CronDaemon: ./.bash_profile Sep 30 23:59:00 ptcfw1 CronDaemon: ./.bashrc Sep 30 23:59:00 ptcfw1 CronDaemon: ./.cshrc Sep 30 23:59:00 ptcfw1 CronDaemon: ./.tcshrc Sep 30 23:59:00 ptcfw1 CronDaemon: Log tarball is:-Logs.tar Sep 30 23:59:00 ptcfw1 CronDaemon: ls: /log/-Logs.tar: No such file or direct ory Sep 30 23:59:01 ptcfw1 CronDaemon: Log tarball size: Sep 30 23:59:01 ptcfw1 CronDaemon: tftp> tftp> Sent 10240 bytes in 0.1 seconds Sep 30 23:59:01 ptcfw1 CronDaemon: tftp> /etc/init.d/cp_backup.sh: cpstart: command not found Sep 30 23:59:01 ptcfw1 CronDaemon: Restart FW services Sep 30 23:59:01 ptcfw1 CronDaemon: tftp> Sent 2352 bytes in 0.0 seconds Sep 30 23:59:01 ptcfw1 CronDaemon: tftp> Rolling backup log transferred to <IP address of Log server> ** From CPbackups.log ** INFO: Creating /opt/CPfw1-50-04/tmp/manage.lock .. cpwd_admin: Failed to get response from cpWatchDog cpwd_admin: Failed to get response from cpWatchDog INFO: /opt/CPfw1-50-04/tmp/manage.lock Released. #### End backup - Tue Sep 30 17:54:14 PDT 2003 #### cpwd_admin: Process CPD is alive, process won't be started again #### Start backup - Tue Sep 23 19:57:31 PDT 2003 #### INFO: Creating /opt/CPfw1-50-04/tmp/manage.lock .. cpwd_admin: Failed to get response from cpWatchDog cpwd_admin: Failed to get response from cpWatchDog INFO: /opt/CPfw1-50-04/tmp/manage.lock Released. #### End backup - Tue Sep 23 19:57:40 PDT 2003 #### #### Start backup - Tue Sep 30 17:54:07 PDT 2003 #### INFO: Creating /opt/CPfw1-50-04/tmp/manage.lock .. ** Backup Script ** #! /bin/bash CPDATE=`date +%m%d%y-%H%M` LOGSERVER="IP of log server" CPLOG=/var/cplog/CPBACKUP.LOG CPTEMP=/tmp/cptemp.log # Stop firewall services cpstop echo Stop FW # Create new/overwrite scratch log file echo *** > $CPTEMP echo Stopping FW services: `date` >> $CPTEMP # Backup all /bin/backup_start all $CPDATE-Full tftp $LOGSERVER echo Send $CPDATE-Full to $LOGSERVER echo Sent Backup file to $LOGSERVER >> $CPTEMP # Backup logs cd $FWDIR/log tar -cvf $CPDATE-Logs.tar . echo Log tarball is: $CPDATE-Logs.tar #pwd # Check size of log file LOGSIZE="`ls -l $FWDIR/log/$CPDATE-Logs.tar | awk '{print $5}'`" echo Log tarball size: $LOGSIZE echo Log tarball size: $LOGSIZE >> $CPTEMP # Send log archive to LOGSERVER tftp $LOGSERVER <<EOF bin put $CPDATE-Logs.tar quit EOF echo Backup of Logfiles sent to $LOGSERVER >> $CPTEMP mv $CPDATE-Logs.tar /var/cplog # Restart firewall services cpstart echo Restart FW services echo Restarting FW services: `date` >> $CPTEMP # Append scratch log to main log file cat $CPTEMP >> $CPLOG # Transfer rolling log to tftp server cd /var/cplog cp CPBACKUP.LOG $CPDATE-BackupLog.log tftp $LOGSERVER <<EOF put $CPDATE-BackupLog.log quit EOF rm -f $CPDATE-BackupLog.log echo Rolling backup log transferred to $LOGSERVER ================================================= To set vacation, Out-Of-Office, or away messages, send an email to [email protected] in the BODY of the email add: set fw-1-mailinglist nomail ================================================= To unsubscribe from this mailing list, please see the instructions at http://www.checkpoint.com/services/mailing.html ================================================= If you have any questions on how to change your subscription options, email [email protected] ================================================= ================================================= To set vacation, Out-Of-Office, or away messages, send an email to [email protected] in the BODY of the email add: set fw-1-mailinglist nomail ================================================= To unsubscribe from this mailing list, please see the instructions at http://www.checkpoint.com/services/mailing.html ================================================= If you have any questions on how to change your subscription options, email [email protected] =================================================
|