[Calypso] [PATCH 2/4] Run calypso as user calypso

Guido Günther agx at sigxcpu.org
Tue Apr 1 00:20:19 PDT 2014


There's no need to run this network facing service as root
---
 calypso-init | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/calypso-init b/calypso-init
index a208a4e..119b72d 100755
--- a/calypso-init
+++ b/calypso-init
@@ -17,10 +17,10 @@
 PATH=/sbin:/usr/sbin:/bin:/usr/bin
 DESC="Calypso CalDAV Server"
 NAME=calypso
-DAEMON=/usr/sbin/$NAME
-PIDFILE=/var/run/$NAME.pid
+DAEMON=/usr/bin/$NAME
+PIDFILE=/var/run/calypso/$NAME.pid
 SCRIPTNAME=/etc/init.d/$NAME
-CALYPSO_OPTS="-d"
+CALYPSO_OPTS="-d -P $PIDFILE"
 
 # Exit if the package is not installed
 [ -x "$DAEMON" ] || exit 0
@@ -60,7 +60,10 @@ do_start()
 	#   2 if daemon could not be started
 	start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON --test > /dev/null \
 		|| return 1
-	start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON -- \
+
+	mkdir -p $(dirname $PIDFILE)
+	chown calypso:calypso $(dirname $PIDFILE)
+	start-stop-daemon --start -c $NAME --quiet --pidfile $PIDFILE --exec $DAEMON -- \
 		$CALYPSO_OPTS \
 		|| return 2
 	# Add code here, if necessary, that waits for the process to be ready
-- 
1.9.0



More information about the Calypso mailing list