geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From xuhaih...@apache.org
Subject svn commit: r817527 - /geronimo/server/branches/2.1/assemblies/geronimo-boilerplate-minimal/src/main/underlay/bin/gserviceReg.sh
Date Tue, 22 Sep 2009 07:53:51 GMT
Author: xuhaihong
Date: Tue Sep 22 07:53:51 2009
New Revision: 817527

URL: http://svn.apache.org/viewvc?rev=817527&view=rev
Log:
GERONIMO-4825 can not config geronimo as a service in ubuntu (Patch from viola.lu)

Modified:
    geronimo/server/branches/2.1/assemblies/geronimo-boilerplate-minimal/src/main/underlay/bin/gserviceReg.sh

Modified: geronimo/server/branches/2.1/assemblies/geronimo-boilerplate-minimal/src/main/underlay/bin/gserviceReg.sh
URL: http://svn.apache.org/viewvc/geronimo/server/branches/2.1/assemblies/geronimo-boilerplate-minimal/src/main/underlay/bin/gserviceReg.sh?rev=817527&r1=817526&r2=817527&view=diff
==============================================================================
--- geronimo/server/branches/2.1/assemblies/geronimo-boilerplate-minimal/src/main/underlay/bin/gserviceReg.sh
(original)
+++ geronimo/server/branches/2.1/assemblies/geronimo-boilerplate-minimal/src/main/underlay/bin/gserviceReg.sh
Tue Sep 22 07:53:51 2009
@@ -135,6 +135,10 @@
 echo '# Default-Stop:      0 1 2 6'>>"$GSERVICE_NAME"
 echo "# Short-Description: $2 daemon">>"$GSERVICE_NAME"
 echo '### END INIT INFO'>>"$GSERVICE_NAME"
+if $osUbuntu; then
+ echo ". /lib/lsb/init-functions" >>"$GSERVICE_NAME"
+ echo "user=$USER" >>"$GSERVICE_NAME"
+fi
 echo "JAVA_HOME=$JAVA_HOME">>"$GSERVICE_NAME"
 echo "export JAVA_HOME">>"$GSERVICE_NAME"
 echo "GERONIMO_HOME=$GERONIMO_HOME">>"$GSERVICE_NAME"
@@ -155,15 +159,26 @@
 echo '}'>>"$GSERVICE_NAME"
 echo 'else  '>>"$GSERVICE_NAME"
 echo '{'>>"$GSERVICE_NAME"
+if $osUbuntu; then 
+echo 'log_daemon_msg "Starting Server"'>>"$GSERVICE_NAME"
+echo 'JAVA_HOME="$JAVA_HOME" start-stop-daemon --make-pidfile --pidfile /var/run/geronimo-server.pid
--background --user $user --exec "$GERONIMO_HOME"/bin/geronimo.sh --start -- run'>>"$GSERVICE_NAME"
+else
 echo 'echo "Start Server on port $RMI_PORT"'>>"$GSERVICE_NAME"
 echo ' "$GERONIMO_HOME"/bin/startup.sh'>>"$GSERVICE_NAME"
+fi
 echo '}'>>"$GSERVICE_NAME"
 echo 'fi'>>"$GSERVICE_NAME"
 echo '}'>>"$GSERVICE_NAME"
 
+
 echo 'stop() {'>>"$GSERVICE_NAME"
+if $osUbuntu; then
+ echo 'log_daemon_msg "Stopping Server"'>>"$GSERVICE_NAME"
+ echo 'killproc -p /var/run/geronimo-server.pid || true'>>"$GSERVICE_NAME"
+else
 echo 'echo "Shutting down server on port ${RMI_PORT}"'>>"$GSERVICE_NAME"
 echo '"$GERONIMO_HOME"/bin/shutdown.sh --user "$ADMIN_USER" --password "$ADMIN_PASS" --port
"$RMI_PORT"'>>"$GSERVICE_NAME"
+fi
 echo '}'>>"$GSERVICE_NAME"
 
 echo 'restart() {'>>"$GSERVICE_NAME"
@@ -216,8 +231,13 @@
 
 chmod +x "$GSERVICE_NAME"
 if [ ! -x /usr/sbin/$2 ]; then
-  ln -sf "$GSERVICE_NAME" /usr/sbin/"$2"
-  chmod +x /usr/sbin/"$2"
+  if $osUbuntu; then
+   sudo ln -sf "$GSERVICE_NAME" /usr/sbin/"$2"
+   sudo chmod +x /usr/sbin/"$2"
+  else
+   ln -sf "$GSERVICE_NAME" /usr/sbin/"$2"
+   chmod +x /usr/sbin/"$2"
+  fi
  if $osSuse; then  
   ln -sf /usr/sbin/"$2" /etc/init.d/"$2"
   insserv "$2"
@@ -231,11 +251,11 @@
    ln -sf /usr/sbin/"$2" /etc/rc3.d/S99"$2"
  fi
  if $osAix; then    
-   echo "$2:2:respawn:/usr/sbin/$2 start">>/etc/inittab
+   echo "$2:2:once:/usr/sbin/$2 start">>/etc/inittab
  fi 
- if $osUbuntu; then
-   ln -sf /usr/sbin/"$2" /etc/init.d/"$2"    
-   update-rc.d $2 defaults 99 01   
+ if $osUbuntu; then    
+   sudo ln -sf /usr/sbin/"$2" /etc/init.d/"$2"
+   sudo update-rc.d $2 defaults   
  fi
 else
 echo "$2 already exists"
@@ -254,11 +274,12 @@
   rm -f /etc/init.d/"$2"  
  fi
  if $osSolaris; then   
-   rm -fr /etc/rc3.d/S99"$2"
+   rm -fr /etc/rc3.d/S99"$2"   
  fi
  if $osUbuntu; then    
-   update-rc.d -f $2 remove
-   rm -f /etc/init.d/"$2"   
+   sudo update-rc.d -f $2 remove
+   sudo rm -f /etc/init.d/"$2"
+   sudo rm -f /usr/sbin/$2 
  fi
  rm -f /usr/sbin/$2
  rm -f "$GSERVICE_NAME" 
@@ -287,5 +308,3 @@
 exit 1
 ;;
 esac
-
-



Mime
View raw message