Good day! Ouh. correction here. forget about -d option.
GIT_DAEMON="$RUBY_HOME/bin/ruby $GITORIOUS_HOME/script/git-proxy -d --pid=$PID_FILE" четверг, 29 ноября 2012 г., 19:47:20 UTC+7 пользователь Artem Silenkov написал: > > Good day! > > We have a problem with git-proxy init script. Git-proxy run fine with it > and daemonize but after few minutes stop to do any work. > With error in log > Looking up "/project/repo.git" > IOError - closed stream > > So no client could push-pull with > fatal: The remote end hung up unexpectedly > > Process is in working state even could strace it but brocken somehow. I'm > not ruby programmer but guess that it is logger problem after daemonizing > like here. > > http://stackoverflow.com/questions/1711603/ruby-daemons-causing-activerecord-logger-ioerror > > We tried to hack git-proxy script with no success. > > This is our init script under ubuntu 12.04 > > #! /bin/sh > ### BEGIN INIT INFO > # Provides: git-proxy > # Required-Start: > # Required-Stop: > # Default-Start: 2 3 4 5 > # Default-Stop: 0 1 6 > # Short-Description: GIT-proxy server daemon > # Description: Starts the GIT-proxy needed by Gitorious > ### END INIT INFO > > # Author: Fabio Akita <*******@gmail.com> > # adapted for git-proxy by 2gis team > > RUBY_HOME="/opt/ruby-enterprise" > GITORIOUS_HOME="/var/www/gitorious" > RETVAL=0 > PROG="git-proxy" > PID_FILE=$GITORIOUS_HOME/log/git-proxy.pid > GIT_DAEMON="$RUBY_HOME/bin/ruby $GITORIOUS_HOME/script/git-proxy > --pid=$PID_FILE" > LOCK_FILE=/var/lock/git-proxy > > export RAILS_ENV=production > > do_check_pid() { > if [ -f $PID_FILE ]; then > PID=`cat $PID_FILE` > RUNNING=`ps --pid $PID | wc -l` > else > PID=0 > RUNNING=0 > fi > } > > runlevel=`runlevel | awk '{print $2}'` > > start() > { > do_check_pid > if [ $RUNNING != 2 ] ; then > echo -n "Starting $PROG" > /bin/su - git -c "export RAILS_ENV=production;$GIT_DAEMON" 2>&1 > >/dev/null > sleep 1 > if [ -f $PID_FILE ] ; then > echo "." > RETVAL=0 > else > echo ": FAILURE!!!" > RETVAL=1 > fi > else > echo "$PROG already running" > RETVAL=1 > fi > [ "$RETVAL" = 0 ] && touch $LOCK_FILE > } > > stop() > { > do_check_pid > if [ $RUNNING != 2 ] ; then > echo "$PROG not running" > else > echo -n "Stopping $PROG" > PROGPID=`cat $PID_FILE` > kill -TERM $PROGPID && echo "." > fi > RETVAL=0 > # if we are in halt or reboot runlevel kill all running sessions > # so the TCP connections are closed cleanly > if [ "x$runlevel" = x0 -o "x$runlevel" = x6 ] ; then > PROGPID=`cat $PID_FILE` > kill -9 $PROGPID > /dev/null > fi > [ "$RETVAL" = 0 ] && { > rm -f $LOCK_FILE && rm -f $PID_FILE > } > } > > case "$1" in > start) > start > ;; > stop) > stop > ;; > restart) > stop > start > ;; > condrestart) > if [ -f $LOCK_FILE ] ; then > if [ "$RETVAL" = 0 ] ; then > stop > # avoid race > sleep 10 > start > fi > fi > ;; > *) > echo "Usage: $0 {start|stop|restart|condrestart}" > RETVAL=1 > esac > exit $RETVAL > > #EOF > > When git-proxy started in console or with cron as described above there > were no errors only when daemonized. No matter how much users try to > pushpull. > > We need more knowledge to investigate further )) > > > вторник, 11 сентября 2012 г., 20:47:27 UTC+7 пользователь Marius Mårnes > Mathiesen написал: >> >> On Fri, Aug 17, 2012 at 6:25 PM, Austin Montgomery <mont...@gmail.com>wrote: >> >>> So I have come up with a solution. I added the following line to my git >>> users crontab and it has the git-proxy up and running without a hitch on >>> reboot. >>> >>> * * * * * cd /var/www/gitorious && env RAILS_ENV=production bundle exec >>> script/git-proxy 2>&1 >/dev/null >>> >>> >> Austin, >> Glad to hear you got it working. A couple of alternatives: >> >> - Use a process monitoring tool like Monit (apt-get install monit). By >> writing a small recipe you can have monit ensure your process (identified >> by a pid file, which the git-proxy script will create) is running. It will >> even make sure the proxy is available on a specific port and can be set up >> to restart the service if it consumes too much resources >> - Create a script in /etc/init.d like you suggested >> - Even better, as Ubuntu has moved from /etc/init.d scripts to Upstart, >> place a script in eg. /etc/init/git-proxy.conf - my Upstart knowledge is a >> little rusty, but I'm sure someone on the list can share something... >> >> Cheers, >> - Marius >> > -- To post to this group, send email to gitorious@googlegroups.com To unsubscribe from this group, send email to gitorious+unsubscr...@googlegroups.com