accumulo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From vi...@apache.org
Subject svn commit: r1397317 - in /accumulo/branches/1.4/src/assemble/platform/debian: ./ init.d/
Date Thu, 11 Oct 2012 21:22:46 GMT
Author: vines
Date: Thu Oct 11 21:22:46 2012
New Revision: 1397317

URL: http://svn.apache.org/viewvc?rev=1397317&view=rev
Log:
ACCUMULO-312 ACCUMULO-791 - Dedicated users, more robust


Modified:
    accumulo/branches/1.4/src/assemble/platform/debian/gc-only-init.sh
    accumulo/branches/1.4/src/assemble/platform/debian/init.d/accumulo-gc
    accumulo/branches/1.4/src/assemble/platform/debian/init.d/accumulo-master
    accumulo/branches/1.4/src/assemble/platform/debian/init.d/accumulo-monitor
    accumulo/branches/1.4/src/assemble/platform/debian/init.d/accumulo-slave
    accumulo/branches/1.4/src/assemble/platform/debian/init.d/accumulo-tracer
    accumulo/branches/1.4/src/assemble/platform/debian/master-only-init.sh
    accumulo/branches/1.4/src/assemble/platform/debian/monitor-only-init.sh
    accumulo/branches/1.4/src/assemble/platform/debian/slave-only-init.sh
    accumulo/branches/1.4/src/assemble/platform/debian/tracer-only-init.sh

Modified: accumulo/branches/1.4/src/assemble/platform/debian/gc-only-init.sh
URL: http://svn.apache.org/viewvc/accumulo/branches/1.4/src/assemble/platform/debian/gc-only-init.sh?rev=1397317&r1=1397316&r2=1397317&view=diff
==============================================================================
--- accumulo/branches/1.4/src/assemble/platform/debian/gc-only-init.sh (original)
+++ accumulo/branches/1.4/src/assemble/platform/debian/gc-only-init.sh Thu Oct 11 21:22:46
2012
@@ -4,5 +4,22 @@ if [ $(id -ur) -ne 0 ]; then
   exit 1
 fi
 
-cp init.d/accumulo-gc /etc/init.d
+if [ ! -f /etc/default/accumulo ]; then
+  mkdir -p /etc/default
+  touch /etc/default/accumulo
+fi
+
+if ! grep "ACCUMULO_USER=" /etc/default/accumulo >> /dev/null ; then
+  echo "ACCUMULO_USER=accumulo" >> /etc/default/accumulo
+fi
+
+if ! id -u accumulo >/dev/null 2>&1; then
+  groupArg="U"
+  if egrep "^accumulo:" /etc/group >> /dev/null; then
+    groupArg="g accumulo"
+  fi
+  useradd -$groupArg -d /usr/lib/accumulo accumulo
+fi
+
+install -m 0755 -o root -g root init.d/accumulo-gc /etc/init.d/
 update-rc.d accumulo-gc defaults 

Modified: accumulo/branches/1.4/src/assemble/platform/debian/init.d/accumulo-gc
URL: http://svn.apache.org/viewvc/accumulo/branches/1.4/src/assemble/platform/debian/init.d/accumulo-gc?rev=1397317&r1=1397316&r2=1397317&view=diff
==============================================================================
--- accumulo/branches/1.4/src/assemble/platform/debian/init.d/accumulo-gc (original)
+++ accumulo/branches/1.4/src/assemble/platform/debian/init.d/accumulo-gc Thu Oct 11 21:22:46
2012
@@ -12,6 +12,7 @@
 # Author: John Vines <john@sqrrl.com>
 
 # Do NOT "set -e"
+install -d -m 0775 -o root -g accumulo /var/run/accumulo
 
 # PATH should only include /usr/* if it runs after the mountnfs.sh script
 PATH=/sbin:/usr/sbin:/bin:/usr/bin:/usr/lib/accumulo/bin
@@ -21,11 +22,11 @@ ACCUMULO_PROC=gc
 DAEMON=/usr/lib/accumulo/bin/start-server.sh
 IP=`ifconfig | grep inet[^6] | awk '{print $2}' | sed 's/addr://' | grep -v 0.0.0.0 | grep
-v 127.0.0.1 | head -n 1`
 DAEMON_ARGS="$IP gc \"garbage collector\""
-PIDFILE=/var/run/$NAME.pid
+PIDFILE=/var/run/accumulo/$NAME.pid
 SCRIPTNAME=/etc/init.d/$NAME
 
 # Read configuration variable file if it is present
-[ -r /etc/default/$NAME ] && . /etc/default/$NAME
+[ -r /etc/default/accumulo ] && . /etc/default/accumulo
 
 # Load the VERBOSE setting and other rcS variables
 . /lib/init/vars.sh
@@ -38,8 +39,10 @@ SCRIPTNAME=/etc/init.d/$NAME
 #
 # Function that starts the daemon/service
 #
-do_start()
-{
+do_start() {
+    TARGET_USER_NAME="ACCUMULO_USER"
+    TARGET_USER=$(eval "echo \$$TARGET_USER_NAME")
+
 	# Return
 	#  0 if daemon has been started
 	#  1 if daemon was already running
@@ -47,7 +50,7 @@ do_start()
 	
 	if [ "`jps -m | grep $ACCUMULO_PROC`" ] ; then return 1; fi
 	
-	$DAEMON $DAEMON_ARGS > /dev/null || return 1
+	su -s /bin/sh $TARGET_USER -c "$DAEMON $DAEMON_ARGS > /dev/null || return 1"
 
 	if [ "`jps -m | grep $ACCUMULO_PROC`" ] ; then return 0; fi
 	return 2

Modified: accumulo/branches/1.4/src/assemble/platform/debian/init.d/accumulo-master
URL: http://svn.apache.org/viewvc/accumulo/branches/1.4/src/assemble/platform/debian/init.d/accumulo-master?rev=1397317&r1=1397316&r2=1397317&view=diff
==============================================================================
--- accumulo/branches/1.4/src/assemble/platform/debian/init.d/accumulo-master (original)
+++ accumulo/branches/1.4/src/assemble/platform/debian/init.d/accumulo-master Thu Oct 11 21:22:46
2012
@@ -12,6 +12,7 @@
 # Author: John Vines <john@sqrrl.com>
 
 # Do NOT "set -e"
+install -d -m 0775 -o root -g accumulo /var/run/accumulo
 
 # PATH should only include /usr/* if it runs after the mountnfs.sh script
 PATH=/sbin:/usr/sbin:/bin:/usr/bin:/usr/lib/accumulo/bin
@@ -25,7 +26,7 @@ PIDFILE=/var/run/$NAME.pid
 SCRIPTNAME=/etc/init.d/$NAME
 
 # Read configuration variable file if it is present
-[ -r /etc/default/$NAME ] && . /etc/default/$NAME
+[ -r /etc/default/accumulo ] && . /etc/default/accumulo
 
 # Load the VERBOSE setting and other rcS variables
 . /lib/init/vars.sh
@@ -40,6 +41,8 @@ SCRIPTNAME=/etc/init.d/$NAME
 #
 do_start()
 {
+    TARGET_USER_NAME="ACCUMULO_USER"
+    TARGET_USER=$(eval "echo \$$TARGET_USER_NAME")
 	# Return
 	#  0 if daemon has been started
 	#  1 if daemon was already running
@@ -47,8 +50,8 @@ do_start()
 	
 	if [ "`jps -m | grep $ACCUMULO_PROC`" ] ; then return 1; fi
 	
-	/usr/lib/accumulo/bin/accumulo org.apache.accumulo.server.master.state.SetGoalState NORMAL
-	$DAEMON $DAEMON_ARGS > /dev/null || return 1
+	su -s /bin/sh $TARGET_USER -c "/usr/lib/accumulo/bin/accumulo org.apache.accumulo.server.master.state.SetGoalState
NORMAL"
+	su -s /bin/sh $TARGET_USER -c "$DAEMON $DAEMON_ARGS > /dev/null || return 1"
 
 	if [ "`jps -m | grep $ACCUMULO_PROC`" ] ; then return 0; fi
 	return 2

Modified: accumulo/branches/1.4/src/assemble/platform/debian/init.d/accumulo-monitor
URL: http://svn.apache.org/viewvc/accumulo/branches/1.4/src/assemble/platform/debian/init.d/accumulo-monitor?rev=1397317&r1=1397316&r2=1397317&view=diff
==============================================================================
--- accumulo/branches/1.4/src/assemble/platform/debian/init.d/accumulo-monitor (original)
+++ accumulo/branches/1.4/src/assemble/platform/debian/init.d/accumulo-monitor Thu Oct 11
21:22:46 2012
@@ -12,6 +12,7 @@
 # Author: John Vines <john@sqrrl.com>
 
 # Do NOT "set -e"
+install -d -m 0775 -o root -g accumulo /var/run/accumulo
 
 # PATH should only include /usr/* if it runs after the mountnfs.sh script
 PATH=/sbin:/usr/sbin:/bin:/usr/bin:/usr/lib/accumulo/bin
@@ -25,7 +26,7 @@ PIDFILE=/var/run/$NAME.pid
 SCRIPTNAME=/etc/init.d/$NAME
 
 # Read configuration variable file if it is present
-[ -r /etc/default/$NAME ] && . /etc/default/$NAME
+[ -r /etc/default/accumulo ] && . /etc/default/accumulo
 
 # Load the VERBOSE setting and other rcS variables
 . /lib/init/vars.sh
@@ -40,6 +41,8 @@ SCRIPTNAME=/etc/init.d/$NAME
 #
 do_start()
 {
+    TARGET_USER_NAME="ACCUMULO_MONITOR_USER"
+    TARGET_USER=$(eval "echo \$$TARGET_USER_NAME")
 	# Return
 	#  0 if daemon has been started
 	#  1 if daemon was already running
@@ -47,7 +50,7 @@ do_start()
 	
 	if [ "`jps -m | grep $ACCUMULO_PROC`" ] ; then return 1; fi
 	
-	$DAEMON $DAEMON_ARGS > /dev/null || return 1
+	su -s /bin/sh $TARGET_USER -c "$DAEMON $DAEMON_ARGS > /dev/null || return 1"
 
 	if [ "`jps -m | grep $ACCUMULO_PROC`" ] ; then return 0; fi
 	return 2

Modified: accumulo/branches/1.4/src/assemble/platform/debian/init.d/accumulo-slave
URL: http://svn.apache.org/viewvc/accumulo/branches/1.4/src/assemble/platform/debian/init.d/accumulo-slave?rev=1397317&r1=1397316&r2=1397317&view=diff
==============================================================================
--- accumulo/branches/1.4/src/assemble/platform/debian/init.d/accumulo-slave (original)
+++ accumulo/branches/1.4/src/assemble/platform/debian/init.d/accumulo-slave Thu Oct 11 21:22:46
2012
@@ -12,6 +12,7 @@
 # Author: John Vines <john@sqrrl.com>
 
 # Do NOT "set -e"
+install -d -m 0775 -o root -g accumulo /var/run/accumulo
 
 # PATH should only include /usr/* if it runs after the mountnfs.sh script
 PATH=/sbin:/usr/sbin:/bin:/usr/bin:/usr/lib/accumulo/bin
@@ -26,7 +27,7 @@ PIDFILE=/var/run/$NAME.pid
 SCRIPTNAME=/etc/init.d/$NAME
 
 # Read configuration variable file if it is present
-[ -r /etc/default/$NAME ] && . /etc/default/$NAME
+[ -r /etc/default/accumulo ] && . /etc/default/accumulo
 
 # Load the VERBOSE setting and other rcS variables
 . /lib/init/vars.sh
@@ -41,6 +42,8 @@ SCRIPTNAME=/etc/init.d/$NAME
 #
 do_start()
 {
+    TARGET_USER_NAME="ACCUMULO_USER"
+    TARGET_USER=$(eval "echo \$$TARGET_USER_NAME")
 	# Return
 	#  0 if daemon has been started
 	#  1 if daemon was already running
@@ -48,8 +51,8 @@ do_start()
 	
 	if [ "`jps -m | grep $ACCUMULO_PROC1`" -a "`jps -m | grep $ACCUMULO_PROC2`" ] ; then return
1; fi
 
-  /usr/lib/accumulo/bin/start-server.sh $IP logger
-  /usr/lib/accumulo/bin/start-server.sh $IP tserver "tablet server"
+  su -s /bin/sh $TARGET_USER -c "/usr/lib/accumulo/bin/start-server.sh $IP logger"
+  su -s /bin/sh $TARGET_USER -c "/usr/lib/accumulo/bin/start-server.sh $IP tserver \"tablet
server\""
 
 	if [ "`jps -m | grep $ACCUMULO_PROC1`" -a "`jps -m | grep $ACCUMULO_PROC2`" ] ; then return
0; fi
 	return 2
@@ -71,7 +74,7 @@ do_stop()
 
 	if [ ! "`jps -m | grep $ACCUMULO_PROC1`" -a ! "`jps -m | grep $ACCUMULO_PROC2`" ] ; then
return 1; fi
 
-	/usr/lib/accumulo/bin/accumulo admin stop $IP 
+	su -s /bin/sh $TARGET_USER -c "/usr/lib/accumulo/bin/accumulo admin stop $IP"
 
 	if [ "`jps -m | grep $ACCUMULO_PROC1`" ] ; then jps -m | grep $ACCUMULO_PROC1 | awk '{print
$1}' | xargs kill -9; fi
 	if [ "`jps -m | grep $ACCUMULO_PROC2`" ] ; then jps -m | grep $ACCUMULO_PROC2 | awk '{print
$1}' | xargs kill -9; fi

Modified: accumulo/branches/1.4/src/assemble/platform/debian/init.d/accumulo-tracer
URL: http://svn.apache.org/viewvc/accumulo/branches/1.4/src/assemble/platform/debian/init.d/accumulo-tracer?rev=1397317&r1=1397316&r2=1397317&view=diff
==============================================================================
--- accumulo/branches/1.4/src/assemble/platform/debian/init.d/accumulo-tracer (original)
+++ accumulo/branches/1.4/src/assemble/platform/debian/init.d/accumulo-tracer Thu Oct 11 21:22:46
2012
@@ -12,6 +12,7 @@
 # Author: John Vines <john@sqrrl.com>
 
 # Do NOT "set -e"
+install -d -m 0775 -o root -g accumulo /var/run/accumulo
 
 # PATH should only include /usr/* if it runs after the mountnfs.sh script
 PATH=/sbin:/usr/sbin:/bin:/usr/bin:/usr/lib/accumulo/bin
@@ -25,7 +26,7 @@ PIDFILE=/var/run/$NAME.pid
 SCRIPTNAME=/etc/init.d/$NAME
 
 # Read configuration variable file if it is present
-[ -r /etc/default/$NAME ] && . /etc/default/$NAME
+[ -r /etc/default/accumulo ] && . /etc/default/accumulo
 
 # Load the VERBOSE setting and other rcS variables
 . /lib/init/vars.sh
@@ -40,6 +41,8 @@ SCRIPTNAME=/etc/init.d/$NAME
 #
 do_start()
 {
+    TARGET_USER_NAME="ACCUMULO_TRACER_USER"
+    TARGET_USER=$(eval "echo \$$TARGET_USER_NAME")
 	# Return
 	#  0 if daemon has been started
 	#  1 if daemon was already running
@@ -47,7 +50,7 @@ do_start()
 	
 	if [ "`jps -m | grep $ACCUMULO_PROC`" ] ; then return 1; fi
 	
-	$DAEMON $DAEMON_ARGS > /dev/null || return 1
+	su -s /bin/sh $TARGET_USER -c "$DAEMON $DAEMON_ARGS > /dev/null || return 1"
 
 	if [ "`jps -m | grep $ACCUMULO_PROC`" ] ; then return 0; fi
 	return 2

Modified: accumulo/branches/1.4/src/assemble/platform/debian/master-only-init.sh
URL: http://svn.apache.org/viewvc/accumulo/branches/1.4/src/assemble/platform/debian/master-only-init.sh?rev=1397317&r1=1397316&r2=1397317&view=diff
==============================================================================
--- accumulo/branches/1.4/src/assemble/platform/debian/master-only-init.sh (original)
+++ accumulo/branches/1.4/src/assemble/platform/debian/master-only-init.sh Thu Oct 11 21:22:46
2012
@@ -3,6 +3,23 @@ if [ $(id -ur) -ne 0 ]; then
   echo "This script must be run as root" 1>&2
   exit 1
 fi
- 
-cp init.d/accumulo-master /etc/init.d
+
+if [ ! -f /etc/default/accumulo ]; then
+  mkdir -p /etc/default
+  touch /etc/default/accumulo
+fi
+
+if ! grep "ACCUMULO_USER=" /etc/default/accumulo  >> /dev/null ; then
+  echo "ACCUMULO_USER=accumulo" >> /etc/default/accumulo
+fi
+
+if ! id -u accumulo >/dev/null 2>&1; then
+  groupArg="U"
+  if egrep "^accumulo:" /etc/group >> /dev/null; then
+    groupArg="g accumulo"
+  fi
+  useradd -$groupArg -d /usr/lib/accumulo accumulo
+fi
+
+install -m 0755 -o root -g root init.d/accumulo-master /etc/init.d/
 update-rc.d accumulo-master start 21 2 3 4 5 . stop 19 0 1 6 .

Modified: accumulo/branches/1.4/src/assemble/platform/debian/monitor-only-init.sh
URL: http://svn.apache.org/viewvc/accumulo/branches/1.4/src/assemble/platform/debian/monitor-only-init.sh?rev=1397317&r1=1397316&r2=1397317&view=diff
==============================================================================
--- accumulo/branches/1.4/src/assemble/platform/debian/monitor-only-init.sh (original)
+++ accumulo/branches/1.4/src/assemble/platform/debian/monitor-only-init.sh Thu Oct 11 21:22:46
2012
@@ -3,7 +3,23 @@ if [ $(id -ur) -ne 0 ]; then
   echo "This script must be run as root" 1>&2
   exit 1
 fi
+
+if [ ! -f /etc/default/accumulo ]; then
+  mkdir -p /etc/default
+  touch /etc/default/accumulo
+fi
+
+if ! grep "ACCUMULO_MONITOR_USER=" /etc/default/accumulo  >> /dev/null ; then
+  echo "ACCUMULO_MONITOR_USER=accumulo_monitor" >> /etc/default/accumulo
+fi
  
-cp init.d/accumulo-monitor /etc/init.d
+if ! id -u accumulo_monitor >/dev/null 2>&1; then
+  if ! egrep "^accumulo:" /etc/group > /dev/null; then
+    groupadd accumulo
+  fi 
+  useradd -d /usr/lib/accumulo -g accumulo accumulo_monitor
+fi
+
+install -m 0755 -o root -g root init.d/accumulo-monitor /etc/init.d/
 update-rc.d accumulo-monitor defaults 
 

Modified: accumulo/branches/1.4/src/assemble/platform/debian/slave-only-init.sh
URL: http://svn.apache.org/viewvc/accumulo/branches/1.4/src/assemble/platform/debian/slave-only-init.sh?rev=1397317&r1=1397316&r2=1397317&view=diff
==============================================================================
--- accumulo/branches/1.4/src/assemble/platform/debian/slave-only-init.sh (original)
+++ accumulo/branches/1.4/src/assemble/platform/debian/slave-only-init.sh Thu Oct 11 21:22:46
2012
@@ -3,6 +3,23 @@ if [ $(id -ur) -ne 0 ]; then
   echo "This script must be run as root" 1>&2
   exit 1
 fi
- 
-cp init.d/accumulo-slave /etc/init.d
+
+if [ ! -f /etc/default/accumulo ]; then
+  mkdir -p /etc/default
+  touch /etc/default/accumulo
+fi
+
+if ! grep "ACCUMULO_USER=" /etc/default/accumulo  >> /dev/null ; then
+  echo "ACCUMULO_USER=accumulo" >> /etc/default/accumulo
+fi
+
+if ! id -u accumulo >/dev/null 2>&1; then
+  groupArg="U"
+  if egrep "^accumulo:" /etc/group >> /dev/null; then
+    groupArg="g accumulo"
+  fi
+  useradd -$groupArg -d /usr/lib/accumulo accumulo
+fi
+
+install -m 0755 -o root -g root init.d/accumulo-slave /etc/init.d/
 update-rc.d accumulo-slave start 21 2 3 4 5 . stop 15 0 1 6 .

Modified: accumulo/branches/1.4/src/assemble/platform/debian/tracer-only-init.sh
URL: http://svn.apache.org/viewvc/accumulo/branches/1.4/src/assemble/platform/debian/tracer-only-init.sh?rev=1397317&r1=1397316&r2=1397317&view=diff
==============================================================================
--- accumulo/branches/1.4/src/assemble/platform/debian/tracer-only-init.sh (original)
+++ accumulo/branches/1.4/src/assemble/platform/debian/tracer-only-init.sh Thu Oct 11 21:22:46
2012
@@ -3,6 +3,22 @@ if [ $(id -ur) -ne 0 ]; then
   echo "This script must be run as root" 1>&2
   exit 1
 fi
+
+if [ ! -f /etc/default/accumulo ]; then
+  mkdir -p /etc/default
+  touch /etc/default/accumulo
+fi
+
+if ! grep "ACCUMULO_TRACER_USER=" /etc/default/accumulo  >> /dev/null ; then
+  echo "ACCUMULO_TRACER_USER=accumulo_tracer" >> /etc/default/accumulo
+fi
  
-cp init.d/accumulo-tracer /etc/init.d
+if ! id -u accumulo_tracer >/dev/null 2>&1; then
+  if ! egrep "^accumulo:" /etc/group >> /dev/null; then
+    groupadd accumulo
+  fi 
+  useradd -d /usr/lib/accumulo -g accumulo accumulo_tracer
+fi
+
+install -m 0755 -o root -g root init.d/accumulo-tracer /etc/init.d/
 update-rc.d accumulo-tracer defaults 



Mime
View raw message