source: publico/ILPortalCasas/trunk/Extensions/BackupPortalModelo.py @ 994

Última Alteração nesse arquivo desde 994 foi 994, incluída por rafahelabazzanella, 14 anos atrás

Implementando sistema de backup do portal

  • Propriedade svn:executable mudada para *
File size: 1.4 KB
Linha 
1import sys, urllib, os, time
2from StringIO import StringIO
3from os import listdir
4
5def instancia(self):
6
7    INSTANCE_HOME = self.Control_Panel.getINSTANCE_HOME()
8
9    BACKUP = INSTANCE_HOME+'/Products/ILPortalCasas/backup'
10
11    PRODUCTS = INSTANCE_HOME+'/Products'
12
13    ZOPE_CONF = INSTANCE_HOME+'/etc/zope.conf'
14
15    DATA_OLD = INSTANCE_HOME+'/var/Data.fs.old'
16
17############################################################
18#   Faz o backup do zope.conf e do conteudo do diretorio   #
19#   Products dentro do diretorio backup                    #
20############################################################
21
22def backupFile(self):
23
24    BACKUP = INSTANCE_HOME+'/Products/ILPortalCasas/backup/bkp_products.txt'
25    x = open(BACKUP)
26    text = x.read()
27   # return text
28
29    PRODUCTS = INSTANCE_HOME+'/Products'
30    xx = listdir(PRODUCTS)
31    return xx
32   
33
34
35
36############################################################
37#   Movendo o arquivo de Backup                            #
38############################################################
39
40#def moveBackup(self):
41
42#    path = ['/var/Data.fs.old']
43#    print "Imprimindo o path", path
44#    source = INSTANCE_HOME,''.join(path)
45#    print "Imprimindo o source", source
46
47#target = 'Data' + time.strftime('%d%m%Y') + '.fs.tgz'
48#tgz_command = "tar -zcvf %s" % (target)
49#if os.system(tgz_command) == 0:
50#    print 'Successful backup to', target
51#    os.system ("rm INSTANCE_HOME+'/var/Data.fs.old")
52#else:
53#       print tgz_command, 'Backup FAILED'
Note: Veja TracBrowser para ajuda no uso do navegador do trac.
 

The contents and data of this website are published under license:
Creative Commons 4.0 Brasil - Atribuir Fonte - Compartilhar Igual.