init.d script.
authorOleksandr Gavenko <gavenkoa@gmail.com>
Sun, 07 Nov 2010 23:17:10 +0200
changeset 675 47d4ad70738f
parent 674 6429d14cfc2a
child 676 e7632a1fdeca
init.d script.
hg.rst
--- a/hg.rst	Sun Nov 07 22:24:33 2010 +0200
+++ b/hg.rst	Sun Nov 07 23:17:10 2010 +0200
@@ -60,6 +60,53 @@
   http://mercurial.selenic.com/wiki/PublishingRepositories
                 Publishing Mercurial Repositories
 
+* Publish repos.
+
+With static HTTP hosting you can copy via rsync, ftp, scp, etc., so long as all the files beneath
+.hg are copied. Also since 1.1 pull protocol can detect static HTTP hosting:
+
+  $ hg clone http://example.com/project
+
+  http://mercurial.selenic.com/wiki/hgserve
+  http://mercurial.selenic.com/wiki/StaticHTTP
+
+** init.d script.
+
+  #!/bin/sh
+  CMD=/usr/bin/hg
+
+  PORT=7878
+  SRC=/srv/hg
+  CONGIG=/srv/hg/hgweb.config
+  PIDFILE=/var/run/hg.pid
+
+  case "$1" in
+  start)
+    echo "Mecurial Server service starting."
+    (cd "$SRC"; $CMD serve -d -p $PORT --pid-file "$PIDFILE")
+    ;;
+  stop)
+    if [ -f "$PIDFILE" ]; then
+      PID=`cat "$PIDFILE"`
+      if [ "$PID" -gt 1 ]; then
+        kill -TERM $PID
+        echo "Stopping the Mercurial service PID=$PID."
+      else
+        echo Bad PID for Mercurial -- \"$PID\".
+        echo You may remove \"$PIDFILE\" manually.
+      fi
+    else
+      echo No PID file recorded for mercurial.
+    fi
+    ;;
+  *)
+    echo "$0 {start|stop}"
+    exit 1
+    ;;
+  esac
+
+  http://mercurial.selenic.com/wiki/hgserve
+
 * Manage patches with MQ.
 
 First enable MQ, add following to your ~/.hgrc: