Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: modules/hgweb/files/hgweb.sh

Issue 29323409: Issue 2867 - Introduce module hgweb and corresponding server role (Closed)
Patch Set: Issue 2867 - Now the complete patch-set again Created Aug. 17, 2015, 6:17 p.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: modules/hgweb/files/hgweb.sh
diff --git a/modules/hgweb/files/hgweb.sh b/modules/hgweb/files/hgweb.sh
new file mode 100755
index 0000000000000000000000000000000000000000..440f77df9f309606b24c6ae45efa274b95acd284
--- /dev/null
+++ b/modules/hgweb/files/hgweb.sh
@@ -0,0 +1,37 @@
+#!/bin/bash
+### BEGIN INIT INFO
+# Provides: hgwebdir
+# Required-Start: $local_fs $remote_fs $network
+# Required-Stop: $local_fs $remote_fs $network
+# Default-Start: 3 5
+# Default-Stop: 0 1 2 6
+# Description: HG FastCGI server
+### END INIT INFO
+
+SCRIPT=/opt/hgweb.fcgi
+FCGI_SOCKET=/var/run/hgweb.sock
+PID_FILE=/var/run/hgweb.pid
+USER=www-data
+
+start() {
+ spawn-fcgi -f $SCRIPT -s $FCGI_SOCKET -P $PID_FILE -u $USER
+}
+
+stop() {
+ if [ -e "$PID_FILE" ]; then
+ kill -9 `cat $PID_FILE` && rm $PID_FILE && rm $FCGI_SOCKET
+ else
+ echo "daemon not running" >&2
+ fi
+}
+
+help() {
+ echo "Usage: $0 {start|stop|restart}"
+ test 'help' = "$1"
+}
+
+case "$1" in
+ start|stop) $1;;
+ restart) stop; start;;
+ *) help "$@";;
+esac

Powered by Google App Engine
This is Rietveld