SVN autoupdates

From Skytech
Jump to: navigation, search


Things for bach_profile file

# .bash_profile

# disable Ctrl-C
function my_ctrlc_handler() {
echo "Ctrl-C trapped."
echo "Please use 'kill -9 $$' to end this script."
}
trap "my_ctrlc_handler" 2 # Ctrl-C gives signal 2

# User specific environment and startup programs
PATH=$PATH:$HOME/bin
export PATH
unset USERNAME

SSHAGENT=/usr/bin/ssh-agent
SSHAGENTARGS="-s"
if [ -z "$SSH_AUTH_SOCK" -a -x "$SSHAGENT" ]; then
   eval `$SSHAGENT $SSHAGENTARGS`
   trap "kill $SSH_AGENT_PID" 0
fi
SSHADD=/usr/bin/ssh-add
`$SSHADD /var/www/.ssh/id_rsa`

echo "Updating test site"
OUT=`/var/www/bin/apache-svn`
echo $OUT

logout

c program to update of svn

eidt /var/www/bin/apache-svn.c Change the last variable execl to point to the approtiate directory

#include <stddef.h>
#include <stdlib.h>
#include <unistd.h>
int main(void)
{
  execl("/usr/bin/svn", "svn", "update", "/DATA/www/test",
        (const char *) NULL);
  return(EXIT_FAILURE);
}

Compile it

gcc /var/www/bin/apache-svn.c -o /var/www/bin/apache-svn-[svn-projekt]