aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPer Andersson <avtobiff@gmail.com>2010-04-17 18:33:51 +0200
committerPer Andersson <avtobiff@gmail.com>2010-04-17 18:41:29 +0200
commit3f4e093ccdb793ef940d21c834fd2ada861f05b4 (patch)
treeaf1779c10785eeae29610fad807a54c0e19daeb0
parent28f21b847430054f30fe62651befb6f4e93c8834 (diff)
downloadetherpad-3f4e093ccdb793ef940d21c834fd2ada861f05b4.tar.gz
etherpad-3f4e093ccdb793ef940d21c834fd2ada861f05b4.tar.xz
etherpad-3f4e093ccdb793ef940d21c834fd2ada861f05b4.zip
added option to configure uid:gid to run daemon as.
-rw-r--r--etherpad/bin/etherpad.default4
-rw-r--r--etherpad/bin/etherpad.init12
2 files changed, 14 insertions, 2 deletions
diff --git a/etherpad/bin/etherpad.default b/etherpad/bin/etherpad.default
index e5ef128..1943cdc 100644
--- a/etherpad/bin/etherpad.default
+++ b/etherpad/bin/etherpad.default
@@ -1,6 +1,10 @@
# Default settings for etherpad. This file is sourced by /bin/sh from
# /etc/init.d/etherpad.
+# User and group to run as
+ETHERPAD_USER="etherpad"
+ETHERPAD_GROUP="etherpad"
+
# Setup paths
ETHERPAD_HOME=/usr/local/etherpad
JAVA=/usr/bin/java
diff --git a/etherpad/bin/etherpad.init b/etherpad/bin/etherpad.init
index 010e811..9c2f447 100644
--- a/etherpad/bin/etherpad.init
+++ b/etherpad/bin/etherpad.init
@@ -23,6 +23,8 @@ NAME=etherpad
#DAEMON_ARGS="--options args"
PIDFILE=/var/run/$NAME.pid
SCRIPTNAME=/etc/init.d/$NAME
+CHUID="$ETHERPAD_USER:$ETHERPAD_GROUP"
+
# Exit if the package is not installed
[ -x "$DAEMON" ] || exit 0
@@ -46,11 +48,17 @@ do_start()
# 0 if daemon has been started
# 1 if daemon was already running
# 2 if daemon could not be started
+
+ # Run as etherpad:etherpad by defaut
+ if [ "$CHUID" = ":" ]; then
+ CHUID="etherpad:etherpad"
+ fi
+
start-stop-daemon --start --quiet --pidfile $PIDFILE --make-pidfile \
- --exec $JAVA --test > /dev/null \
+ --chuid $CHUID --exec $JAVA --test > /dev/null \
|| return 1
start-stop-daemon --start --quiet --pidfile $PIDFILE --make-pidfile \
- --exec $JAVA -- $ETHERPAD_OPTS
+ --chuid $CHUID --exec $JAVA -- $ETHERPAD_OPTS
|| return 2
# Add code here, if necessary, that waits for the process to be ready
# to handle requests from services started subsequently which depend