You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@subversion.apache.org by kkrikor <kr...@gmail.com> on 2006/12/05 19:15:22 UTC

execute java jar file in a post-commit hook

Does this work ? I placed the following code in post-commit
Code:


# Trigger a build everytime a commit happens
/usr/local/java/bin/java -jar
/home/x/triggerContBuild/target/triggerContBuild/trigger/triggerContBuild.jar

# Send an email everytime a commit happens
/var/www/svnroot/hooks/commit-email.pl --from x@x.com "$REPOS" "$REV"
x@x.com



When i execute this post-commit on the command the jar file runs , But when
i do a commit i get the email but the java jar file does not run. Any
thoughts?

I am using Http for my commits, i know the http server runs as apache user.
So i did a su to apache and tried to execute it on the command line that
worked too. So what am i missing ? 
-- 
View this message in context: http://www.nabble.com/execute-java-jar-file-in-a-post-commit-hook-tf2763610.html#a7705831
Sent from the Subversion Dev mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: execute java jar file in a post-commit hook

Posted by kkrikor <kr...@gmail.com>.
Moved this to 

http://www.nabble.com/execute-java-jar-file-in-a-post-commit-hook-tf2764050.html

Thank you


kkrikor wrote:
> 
> Does this work ? I placed the following code in post-commit
> Code:
> 
> 
> # Trigger a build everytime a commit happens
> /usr/local/java/bin/java -jar
> /home/x/triggerContBuild/target/triggerContBuild/trigger/triggerContBuild.jar
> 
> # Send an email everytime a commit happens
> /var/www/svnroot/hooks/commit-email.pl --from x@x.com "$REPOS" "$REV"
> x@x.com
> 
> 
> 
> When i execute this post-commit on the command the jar file runs , But
> when i do a commit i get the email but the java jar file does not run. Any
> thoughts?
> 
> I am using Http for my commits, i know the http server runs as apache
> user. So i did a su to apache and tried to execute it on the command line
> that worked too. So what am i missing ? 
> 

-- 
View this message in context: http://www.nabble.com/execute-java-jar-file-in-a-post-commit-hook-tf2763610.html#a7707390
Sent from the Subversion Dev mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: execute java jar file in a post-commit hook

Posted by kkrikor <kr...@gmail.com>.
This is my command line environment 

HOSTNAME=x.x.com
TERM=xterm
SHELL=/bin/bash
HISTSIZE=1000
SSH_TTY=/dev/pts/1
USER=kkrumlian
LS_COLORS=no=:*.xpm=00;35:*.png=00;35:*.tif=00;35:
KDEDIR=/usr
MAVEN_HOME=/usr/local/maven
MAIL=/var/spool/mail/x
PATH=/usr/local/java//bin:/usr/local/maven/bin:/usr/kerberos/bin:/usr/local/bin:/bin:/usr/bin:/usr/X11R6/bin
INPUTRC=/etc/inputrc
PWD=/var/www/svnroot/hooks
JAVA_HOME=/usr/local/java/
LANG=en_US.UTF-8
SHLVL=1
LESSOPEN=|/usr/bin/lesspipe.sh %s
G_BROKEN_FILENAMES=1
_=/bin/env
OLDPWD=/var/www/svnroot

So i took the Path part and i put it into my script which gets called by the
post-commit. 
By the way the file is now being created but it is empty. When I execute
this command 
on command line I get the file but with JAVA info.

I don't really undrestand what else i need to add or why Java is not
running. here's my 
new cmds in post-commit

export JAVA_HOME=/usr/local/java/
export SHELL=/bin/bash
export
PATH=/usr/local/java//bin:/usr/local/maven/bin:/usr/kerberos/bin:/usr/local/bin:/bin:/usr/bin:/usr/\
X11R6/bin:
JAVA=/usr/local/java/bin/java
/usr/local/java/bin/java > /var/www/html/k.txt




Daniel Rall-2 wrote:
> 
> This is almost certainly a problem with your environment when
> executing the post-commit hook script.  Find out what's different
> between your command-line execution environment and the post-commit
> environment.
> 
> On Tue, 05 Dec 2006, kkrikor wrote:
> 
>> 
>> I did the following , I execute this from my post-commit script
>> 
>> #!/bin/sh
>> 
>> export JAVA_HOME=/usr/local/java/
>> export PATH=/usr/kerberos/bin:/usr/local/bin:/bin:/usr/bin:/usr/X11R6/bin
>> JAVA=/usr/local/java/bin/java
>> 
>> /usr/local/java/bin/java > k.txt
>> 
>> The file does not get created as usual when i run the post-commit on the
>> command 
>> line it works fine
>> 
>> 
>> Daniel Rall-2 wrote:
>> > 
>> > On Tue, 05 Dec 2006, kkrikor wrote:
>> > 
>> >> 
>> >> Does this work ? I placed the following code in post-commit
>> >> Code:
>> >> 
>> >> 
>> >> # Trigger a build everytime a commit happens
>> >> /usr/local/java/bin/java -jar
>> >>
>> /home/x/triggerContBuild/target/triggerContBuild/trigger/triggerContBuild.jar
>> >> 
>> >> # Send an email everytime a commit happens
>> >> /var/www/svnroot/hooks/commit-email.pl --from x@x.com "$REPOS" "$REV"
>> >> x@x.com
>> >> 
>> >> 
>> >> 
>> >> When i execute this post-commit on the command the jar file runs , But
>> >> when
>> >> i do a commit i get the email but the java jar file does not run. Any
>> >> thoughts?
>> >> 
>> >> I am using Http for my commits, i know the http server runs as apache
>> >> user.
>> >> So i did a su to apache and tried to execute it on the command line
>> that
>> >> worked too. So what am i missing ? 
>> > 
>> > This question is most appropriate for the users mailing list.  This
>> > list is about the development of Subversion itself.
>> > 
>> > Does the user your httpd is running as have access to the
>> > /home/x/triggerContBuild/target/triggerContBuild/trigger/ directory?
>> > Does he have JAVA_HOME set?
>> > 
>> > Try redirecting the stdout and stderr output from the 'java' command
>> > into a file if you're still having problems, to see why it's not
>> > running.
>> > 
>> >  
>> > 
>> 
>> -- 
>> View this message in context:
>> http://www.nabble.com/execute-java-jar-file-in-a-post-commit-hook-tf2763610.html#a7708156
>> Sent from the Subversion Dev mailing list archive at Nabble.com.
>> 
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
>> For additional commands, e-mail: dev-help@subversion.tigris.org
> 
>  
> 

-- 
View this message in context: http://www.nabble.com/execute-java-jar-file-in-a-post-commit-hook-tf2763610.html#a7708960
Sent from the Subversion Dev mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: execute java jar file in a post-commit hook

Posted by Daniel Rall <dl...@collab.net>.
This is almost certainly a problem with your environment when
executing the post-commit hook script.  Find out what's different
between your command-line execution environment and the post-commit
environment.

On Tue, 05 Dec 2006, kkrikor wrote:

> 
> I did the following , I execute this from my post-commit script
> 
> #!/bin/sh
> 
> export JAVA_HOME=/usr/local/java/
> export PATH=/usr/kerberos/bin:/usr/local/bin:/bin:/usr/bin:/usr/X11R6/bin
> JAVA=/usr/local/java/bin/java
> 
> /usr/local/java/bin/java > k.txt
> 
> The file does not get created as usual when i run the post-commit on the
> command 
> line it works fine
> 
> 
> Daniel Rall-2 wrote:
> > 
> > On Tue, 05 Dec 2006, kkrikor wrote:
> > 
> >> 
> >> Does this work ? I placed the following code in post-commit
> >> Code:
> >> 
> >> 
> >> # Trigger a build everytime a commit happens
> >> /usr/local/java/bin/java -jar
> >> /home/x/triggerContBuild/target/triggerContBuild/trigger/triggerContBuild.jar
> >> 
> >> # Send an email everytime a commit happens
> >> /var/www/svnroot/hooks/commit-email.pl --from x@x.com "$REPOS" "$REV"
> >> x@x.com
> >> 
> >> 
> >> 
> >> When i execute this post-commit on the command the jar file runs , But
> >> when
> >> i do a commit i get the email but the java jar file does not run. Any
> >> thoughts?
> >> 
> >> I am using Http for my commits, i know the http server runs as apache
> >> user.
> >> So i did a su to apache and tried to execute it on the command line that
> >> worked too. So what am i missing ? 
> > 
> > This question is most appropriate for the users mailing list.  This
> > list is about the development of Subversion itself.
> > 
> > Does the user your httpd is running as have access to the
> > /home/x/triggerContBuild/target/triggerContBuild/trigger/ directory?
> > Does he have JAVA_HOME set?
> > 
> > Try redirecting the stdout and stderr output from the 'java' command
> > into a file if you're still having problems, to see why it's not
> > running.
> > 
> >  
> > 
> 
> -- 
> View this message in context: http://www.nabble.com/execute-java-jar-file-in-a-post-commit-hook-tf2763610.html#a7708156
> Sent from the Subversion Dev mailing list archive at Nabble.com.
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
> For additional commands, e-mail: dev-help@subversion.tigris.org

Re: execute java jar file in a post-commit hook

Posted by kkrikor <kr...@gmail.com>.
I did the following , I execute this from my post-commit script

#!/bin/sh

export JAVA_HOME=/usr/local/java/
export PATH=/usr/kerberos/bin:/usr/local/bin:/bin:/usr/bin:/usr/X11R6/bin
JAVA=/usr/local/java/bin/java

/usr/local/java/bin/java > k.txt

The file does not get created as usual when i run the post-commit on the
command 
line it works fine


Daniel Rall-2 wrote:
> 
> On Tue, 05 Dec 2006, kkrikor wrote:
> 
>> 
>> Does this work ? I placed the following code in post-commit
>> Code:
>> 
>> 
>> # Trigger a build everytime a commit happens
>> /usr/local/java/bin/java -jar
>> /home/x/triggerContBuild/target/triggerContBuild/trigger/triggerContBuild.jar
>> 
>> # Send an email everytime a commit happens
>> /var/www/svnroot/hooks/commit-email.pl --from x@x.com "$REPOS" "$REV"
>> x@x.com
>> 
>> 
>> 
>> When i execute this post-commit on the command the jar file runs , But
>> when
>> i do a commit i get the email but the java jar file does not run. Any
>> thoughts?
>> 
>> I am using Http for my commits, i know the http server runs as apache
>> user.
>> So i did a su to apache and tried to execute it on the command line that
>> worked too. So what am i missing ? 
> 
> This question is most appropriate for the users mailing list.  This
> list is about the development of Subversion itself.
> 
> Does the user your httpd is running as have access to the
> /home/x/triggerContBuild/target/triggerContBuild/trigger/ directory?
> Does he have JAVA_HOME set?
> 
> Try redirecting the stdout and stderr output from the 'java' command
> into a file if you're still having problems, to see why it's not
> running.
> 
>  
> 

-- 
View this message in context: http://www.nabble.com/execute-java-jar-file-in-a-post-commit-hook-tf2763610.html#a7708156
Sent from the Subversion Dev mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: execute java jar file in a post-commit hook

Posted by Daniel Rall <dl...@collab.net>.
On Tue, 05 Dec 2006, kkrikor wrote:

> 
> Does this work ? I placed the following code in post-commit
> Code:
> 
> 
> # Trigger a build everytime a commit happens
> /usr/local/java/bin/java -jar
> /home/x/triggerContBuild/target/triggerContBuild/trigger/triggerContBuild.jar
> 
> # Send an email everytime a commit happens
> /var/www/svnroot/hooks/commit-email.pl --from x@x.com "$REPOS" "$REV"
> x@x.com
> 
> 
> 
> When i execute this post-commit on the command the jar file runs , But when
> i do a commit i get the email but the java jar file does not run. Any
> thoughts?
> 
> I am using Http for my commits, i know the http server runs as apache user.
> So i did a su to apache and tried to execute it on the command line that
> worked too. So what am i missing ? 

This question is most appropriate for the users mailing list.  This
list is about the development of Subversion itself.

Does the user your httpd is running as have access to the
/home/x/triggerContBuild/target/triggerContBuild/trigger/ directory?
Does he have JAVA_HOME set?

Try redirecting the stdout and stderr output from the 'java' command
into a file if you're still having problems, to see why it's not
running.

Re: execute java jar file in a post-commit hook

Posted by Mark Phippard <ma...@gmail.com>.
On 12/5/06, kkrikor <kr...@gmail.com> wrote:
>
>
> Does this work ? I placed the following code in post-commit
> Code:
>
>
> # Trigger a build everytime a commit happens
> /usr/local/java/bin/java -jar
>
> /home/x/triggerContBuild/target/triggerContBuild/trigger/triggerContBuild.jar
>
> # Send an email everytime a commit happens
> /var/www/svnroot/hooks/commit-email.pl --from x@x.com "$REPOS" "$REV"
> x@x.com
>
>
>
> When i execute this post-commit on the command the jar file runs , But
> when
> i do a commit i get the email but the java jar file does not run. Any
> thoughts?
>
> I am using Http for my commits, i know the http server runs as apache
> user.
> So i did a su to apache and tried to execute it on the command line that
> worked too. So what am i missing ?


This would be more appropriate on the users@ list and would probably get
more responses.  The only thing I can suggest, from other messages I have
seen, is that hooks are also executed without any environment variables
set.  So you might need to just setup the environment more before running
Java.

Mark