[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

backup script and python



hi, I've made a very simple script to backup zope files, it work just
fine when I launch it from shell, then I inserted it in cron so it
runs automatically. But runned by cron, it only returns error. Bellow
my script, and the python script that it's calls.

backup_zenoss.sh
#!/bin/bash
export DATE=`date +%d-%h-%y-%Hhs%Mmin`
export ZENHOME=/usr/local/zenoss
export LOG=/usr/local/zenoss/scripts/LOG/backup_ZENOSS.$DATE.log
   date >> $LOG
   echo "BEGINNING DAILY BACKUP ZENOSS" >> $LOG
   cd /usr/local/zenoss
   /usr/local/zenoss/bin/zenbackup.py --file=/usr/local/zenoss/var/backup/backup_ZENOSS.$DATE.tar
   if [ $? = 0 ]
    then
      echo "BACKUP EXECUTED WITH SUCCESS" >> $LOG
    else
      echo "BACKUP ZENOSS WITH TROUBLE - ERROR!" >> $LOG
   fi
#EXCLUDING FILES WITH MORE ONE WEEK.
   find /usr/local/zenoss/var/backukp -name \*.tar -mtime +7 -exec rm {} \;
#FILES WITH MORE ONE WEEK DELETED.

zenbackup.py
#! /usr/bin/env python
__doc__='''zenbackup
Creates backup of zope data files, zenoss conf files and the events database.
'''

import Globals
from Products.ZenUtils.CmdBase import CmdBase
from Products.ZenUtils.ZCmdBase import ZCmdBase
import sys
import os
import os.path
import tempfile
from datetime import date
import getpass

# This is written in Python because in was originally a subclass of ZCmdBase.
# Since that is no longer the case this would probably be cleaner now if done
# as a shell script.

class ZenBackup(CmdBase):
... and so on, it's to quite big

thanks for any help

--
Henrique G. Abreu
henrique@turbokit.com.br



Reply to: