I've got a really simple post-commit python script that is supposed to do a repository backup using 'dar' and write that it did so into a log file. This script works when called from a command line. When run as a subversion hook though, it stops at the 'subprocess.Popen' command. Nothing beyond the 'logfile.print' just before it is written, and the dar command is not run (the archive is unchanged). Any ideas what's going on? Thanks.
code:
Code:
#!/usr/bin/python
import sys
import subprocess
import datetime
rev = sys.argv[2]
if not str.isdigit(rev):
print "Revision Number Error: " + rev
else:
rev = int(rev)
logfile = open('/home/svn/test-repo-bakup.log','a')
logfile.write("\n\n------------\n")
logfile.write(str(datetime.datetime.now()) + "\n")
if (rev % 10) == 0:
logfile.write("Full Backup\n")
subprocess.Popen([r"dar","-c","/home/svn/mnt/SYSDV2-Backup/svn/svn-backup","-R","/home/svn/repos/","-y","-w"],stdout = logfile, stderr = logfile)
else:
logfile.write("Differential Backup\n")
subprocess.Popen([r"dar","-c","/home/svn/mnt/SYSDV2-Backup/svn/svn-backup-diff","-R","/home/svn/repos/","-y","-A","/home/svn/mnt/SYSDV2-Backup/svn/svn-backup","-w"],stdout = logfile, stderr = logfile)
logfile.write("\n\n------------\n")
logfile.close()