LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices

Reply
 
LinkBack Search this Thread
Old 01-16-2007, 02:22 PM   #1
pajamabama
LQ Newbie
 
Registered: Jan 2006
Location: Golden, CO
Distribution: Sabayon 3.26 x64
Posts: 28

Rep: Reputation: 15
subversion post-commit hook problems


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()
 
Old 01-17-2007, 12:37 PM   #2
pajamabama
LQ Newbie
 
Registered: Jan 2006
Location: Golden, CO
Distribution: Sabayon 3.26 x64
Posts: 28

Original Poster
Rep: Reputation: 15
maybe I should just use bash instead of python?
 
Old 01-19-2007, 05:14 PM   #3
pajamabama
LQ Newbie
 
Registered: Jan 2006
Location: Golden, CO
Distribution: Sabayon 3.26 x64
Posts: 28

Original Poster
Rep: Reputation: 15
Solved

I forgot the note that the $PATH variable is not passed into svn hook scripts so absolute path must be specified for subprocesses.

It's working now.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
subversion commit failures irfanhab Linux - Software 0 06-05-2006 09:43 PM
Subversion Import Problems vbfischer Programming 1 03-21-2006 09:37 AM
subversion: commit failed kenneho Linux - Software 0 09-07-2005 01:02 PM
Subversion -> commit? hylke Linux - Newbie 1 05-15-2005 08:44 AM
How to install Subversion(Version Control with Subversion) under RedHat Linux. netkiller Linux - Networking 1 07-01-2004 05:45 AM


All times are GMT -5. The time now is 01:17 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration