Changeset 1579
- Timestamp:
- 12/10/06 19:17:31 (14 years ago)
- Location:
- TI01-discovery/trunk/ingestAutomation
- Files:
-
- 1 deleted
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
TI01-discovery/trunk/ingestAutomation/exist_backup.py
r962 r1579 3 3 # Usage: exist_backup <database> <target directory> 4 4 # 5 # Uses backup _ndg.sh client with the -d dump option to dump the database to disc.5 # Uses backup.sh client with the -d dump option to dump the database to disc. 6 6 # The directory tree of dumped files is put in 7 7 # the target directory and is named using the current date and time. … … 17 17 # 12/05/06 SEL spelling correction 18 18 # 18/05/06 SEL Don't echo the password 19 # 27/09/06 SEL The eXist db has been deployed differently. The database resides in the usual 20 # tomcat webapps directory, but the admin client has also been installed at 21 # /usr/local/exist-client for doing command-line backups etc. 19 22 # 20 23 import sys … … 23 26 24 27 status = 0 25 os.putenv ('PATH', '/usr/local/eXist/bin:/bin:/usr/bin:.') 26 os.putenv ('EXIST_HOME', '/usr/local/eXist') 28 os.putenv ('PATH', '/usr/local/exist-client/bin:/bin:/usr/bin:.') 29 os.putenv ('JAVA_HOME', '/usr/java/jdk1.5.0_03') 30 os.putenv ('EXIST_HOME', '/usr/local/exist-client') 27 31 28 TMP_DIR = '/usr/local/eXist/backup'32 #TMP_DIR = '/usr/local/exist/backup' 29 33 34 # replace glue.badc.rl.ac.uk with actual location if different eg. machine.ac.uk or localhost 30 35 if (len(sys.argv) < 3): 31 36 print "<database> and <target_directory> parameters not supplied - will use defaults" 32 database = 'xmldb:exist:// localhost:8080/exist/xmlrpc'37 database = 'xmldb:exist://glue.badc.rl.ac.uk:8080/exist/xmlrpc' 33 38 target_directory = '/disks/glue1/existBackup/dev/data' 34 39 else: … … 36 41 target_directory = sys.argv[2] 37 42 38 os.chdir('/usr/local/e Xist')43 os.chdir('/usr/local/exist-client') 39 44 40 45 date_string = commands.getoutput ("date +'%y%m%d_%H%M'") … … 42 47 print " Backup directory: ", backup_directory 43 48 44 cmd = "/usr/local/e Xist/bin/backup_ndg.sh -d /usr/local/eXist/backup-u admin -p xxxxxxx -b /db -ouri=" + database49 cmd = "/usr/local/exist-client/bin/backup.sh -d " + backup_directory + " -u admin -p xxxxxxx -b /db -ouri=" + database 45 50 print "Executing: the actual backup command" 46 51 status = os.system (cmd) 47 52 if status != 0: 48 sys.exit('FAILED when running the backup command backup _ndg.sh. Status = %s' %status)53 sys.exit('FAILED when running the backup command backup.sh. Status = %s' %status) 49 54 50 cmd = "mkdir " + backup_directory51 print "Executing: ", cmd52 status = os.system (cmd)55 #cmd = "mkdir " + backup_directory 56 #print "Executing: ", cmd 57 #status = os.system (cmd) 53 58 54 cmd = "cp -R " + TMP_DIR + "/* " + backup_directory 55 print "Executing: ", cmd56 status = os.system (cmd)59 #cmd = "cp -R " + TMP_DIR + "/* " + backup_directory 60 #print "Executing: ", cmd 61 #status = os.system (cmd) 57 62 58 63 print "eXist_backup script completed " + commands.getoutput ("date +'%y%m%d_%H%M'")
Note: See TracChangeset
for help on using the changeset viewer.