[Groonga-commit] droonga/droonga-http-server at 3f94f4f [master] Run as the service user

Back to archive index

YUKI Hiroshi null+****@clear*****
Thu Sep 25 12:03:56 JST 2014


YUKI Hiroshi	2014-09-25 12:03:56 +0900 (Thu, 25 Sep 2014)

  New Revision: 3f94f4fec43f7ad52aa7c9b2b7673e7a08d2e3d0
  https://github.com/droonga/droonga-http-server/commit/3f94f4fec43f7ad52aa7c9b2b7673e7a08d2e3d0

  Message:
    Run as the service user

  Modified files:
    install.sh
    install/debian/droonga-http-server

  Modified: install.sh (+8 -3)
===================================================================
--- install.sh    2014-09-25 11:46:18 +0900 (3b6f1be)
+++ install.sh    2014-09-25 12:03:56 +0900 (be76a5e)
@@ -37,7 +37,7 @@ NAME=droonga-http-server
 SCRIPT_URL=https://raw.githubusercontent.com/droonga/$NAME/master/install
 REPOSITORY_URL=https://github.com/droonga/$NAME.git
 USER=$NAME
-GROUP=$USER
+GROUP=droonga
 DROONGA_BASE_DIR=/home/$USER/droonga
 
 EXPRESS_DROONGA_REPOSITORY_URL=git://github.com/droonga/express-droonga.git#master
@@ -87,11 +87,16 @@ prepare_environment() {
 }
 
 prepare_user() {
+  echo ""
+  echo "Preparing the user..."
+
+  groupadd $GROUP
+
   if ! exist_user $USER; then
-    echo ""
-    echo "Preparing the user..."
     useradd -m $USER
   fi
+
+  usermod -G $GROUP $USER
 }
 
 setup_configuration_directory() {

  Modified: install/debian/droonga-http-server (+3 -3)
===================================================================
--- install/debian/droonga-http-server    2014-09-25 11:46:18 +0900 (7eca662)
+++ install/debian/droonga-http-server    2014-09-25 12:03:56 +0900 (aabb8b7)
@@ -15,7 +15,7 @@ PATH=/sbin:/usr/sbin:/bin:/usr/bin
 DESC=""
 NAME=droonga-http-server
 USER=$NAME
-GROUP=$USER
+GROUP=droonga
 DAEMON=/usr/local/bin/$NAME
 export DROONGA_BASE_DIR=/home/$NAME/droonga
 PIDFILE=/var/run/$NAME/$NAME.pid
@@ -45,9 +45,9 @@ do_start()
 	#   0 if daemon has been started
 	#   1 if daemon was already running
 	#   2 if daemon could not be started
-	start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON --test > /dev/null \
+	start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON --user $USER --test > /dev/null \
 		|| return 1
-	start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON -- \
+	start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON --user $USER --chuid $USER:$GROUP --chdir $DROONGA_BASE_DIR -- \
 		$DAEMON_ARGS \
 		|| return 2
 	# Add code here, if necessary, that waits for the process to be ready
-------------- next part --------------
HTML����������������������������...
Download 



More information about the Groonga-commit mailing list
Back to archive index