[Swift-commit] r3977 - usertools/persistent-coasters

noreply at svn.ci.uchicago.edu noreply at svn.ci.uchicago.edu
Mon Jan 17 14:34:14 CST 2011


Author: wozniak
Date: 2011-01-17 14:34:14 -0600 (Mon, 17 Jan 2011)
New Revision: 3977

Added:
   usertools/persistent-coasters/start-service.zsh
Removed:
   usertools/persistent-coasters/run.zsh
Log:
Rename main script


Deleted: usertools/persistent-coasters/run.zsh
===================================================================
--- usertools/persistent-coasters/run.zsh	2011-01-17 20:33:30 UTC (rev 3976)
+++ usertools/persistent-coasters/run.zsh	2011-01-17 20:34:14 UTC (rev 3977)
@@ -1,134 +0,0 @@
-#!/bin/zsh
-
-# If you get "Could not get coasters service" the
-# service may already be running on SERVICE_PORT
-
-# Process management is incomplete here, check for
-# processes with ps
-
-set -x
-
-PC=$( cd $( dirname $0 ) ; /bin/pwd )
-TOOLS=${PC} # In the future this might be ${SWIFT_HOME}/tools
-source ${TOOLS}/helpers.zsh
-[[ $? != 0 ]] && print "Could not load helpers.zsh!" && exit 1
-
-[[ ${SWIFT} == "" ]] && SWIFT=$( which swift )
-SWIFT_BIN=$( dirname ${SWIFT} )
-COASTER_RESOURCES=${SWIFT_BIN}/../../../../provider-coaster/resources
-WORKER=${COASTER_RESOURCES}/worker.pl
-
-export SERVICE_PORT=10985
-
-LOGDIR=logs
-mkdir -p ${LOGDIR}
-exitcode
-
-SWIFT_OUT=${LOGDIR}/swift.out
-
-local OUT=$1
-
-source workers-local.zsh
-# source workers-ssh.zsh
-
-# Obtain the URL to which Swift should connect
-get_service_coasters()
-{
-  local OUT=$1
-  LINE=()
-  COUNT=0
-  for COUNT in {1..3}
-   do
-   LINE=( $( grep --text "Started coaster service:" ${OUT} ) )
-   if [[ ${#LINE} == 0 ]] then
-     grep Error ${OUT} >& /dev/null && return 1
-     sleep 3
-   else
-     break
-   fi
-  done
-  [[ ${#LINE} == 0 ]] && return 1
-
-  CONTACT=${LINE[-1]}
-  print ${CONTACT}
-  return 0
-}
-
-# Obtain the URL to which the workers should connect
-get_service_local()
-{
-  local OUT=$1
-  LINE=()
-  COUNT=0
-  for COUNT in {1..4}
-  do
-   LINE=( $( grep "Passive queue processor" ${OUT} ) )
-   if [[ ${#LINE} == 0 ]] then
-     sleep 4
-   else
-     break
-   fi
-   if grep "Error" ${OUT} >& /dev/null
-     then
-     print "coaster-service error!" >&2
-     cat ${OUT} >&2
-     return 1
-   fi
-  done
-  [[ ${#LINE} == 0 ]] && return 1
-
-  CONTACT=${LINE[-1]}
-  print ${CONTACT}
-  return 0
-}
-
-SIGNALS="EXIT INT QUIT"
-cleanup_trap()
-{
-  print "cleanup_trap()..."
-  eval trap - ${SIGNALS}
-  [[ ${COASTER_SERVICE_PID} != "" ]] && kill ${COASTER_SERVICE_PID}
-  [[ ${STARTWORKERS_PID}    != "" ]] && kill ${START_WORKERS_PID}
-}
-# eval trap cleanup_trap ${SIGNALS}
-
-SERVICE_LOG=${LOGDIR}/coaster-service.log
-coaster-service -nosec -p ${SERVICE_PORT} >& ${SERVICE_LOG} &
-COASTER_SERVICE_PID=${!}
-
-sleep 1
-
-SERVICE_COASTERS=$( get_service_coasters ${SERVICE_LOG} )
-exitcode "Could not get coasters service!"
-export SERVICE_COASTERS
-
-source setup.sh
-exitcode "setup.sh failed!"
-
-sleep 1
-
-{ ${SWIFT} -config swift.properties \
-           -sites.file sites.passivate.xml \
-           -tc.file tc.passivate.data \
-           passivate.swift < /dev/null >& ${SWIFT_OUT}
-  exitcode "Swift failed!"
-  print "Swift finished."
-} &
-SWIFT_PID=${!}
-
-sleep 1
-
-pwd
-SERVICE_LOCAL=$( get_service_local ${SWIFT_OUT} )
-exitcode "get_service_local failed!"
-export SERVICE_LOCAL
-
-sleep 1
-
-print "Starting workers..."
-start_workers ${SERVICE_LOCAL} &
-START_WORKERS_PID=${!}
-
-sleep 1
-
-exit 0

Copied: usertools/persistent-coasters/start-service.zsh (from rev 3973, usertools/persistent-coasters/run.zsh)
===================================================================
--- usertools/persistent-coasters/start-service.zsh	                        (rev 0)
+++ usertools/persistent-coasters/start-service.zsh	2011-01-17 20:34:14 UTC (rev 3977)
@@ -0,0 +1,134 @@
+#!/bin/zsh
+
+# If you get "Could not get coasters service" the
+# service may already be running on SERVICE_PORT
+
+# Process management is incomplete here, check for
+# processes with ps
+
+set -x
+
+PC=$( cd $( dirname $0 ) ; /bin/pwd )
+TOOLS=${PC} # In the future this might be ${SWIFT_HOME}/tools
+source ${TOOLS}/helpers.zsh
+[[ $? != 0 ]] && print "Could not load helpers.zsh!" && exit 1
+
+[[ ${SWIFT} == "" ]] && SWIFT=$( which swift )
+SWIFT_BIN=$( dirname ${SWIFT} )
+COASTER_RESOURCES=${SWIFT_BIN}/../../../../provider-coaster/resources
+WORKER=${COASTER_RESOURCES}/worker.pl
+
+export SERVICE_PORT=10985
+
+LOGDIR=logs
+mkdir -p ${LOGDIR}
+exitcode
+
+SWIFT_OUT=${LOGDIR}/swift.out
+
+local OUT=$1
+
+source workers-local.zsh
+# source workers-ssh.zsh
+
+# Obtain the URL to which Swift should connect
+get_service_coasters()
+{
+  local OUT=$1
+  LINE=()
+  COUNT=0
+  for COUNT in {1..3}
+   do
+   LINE=( $( grep --text "Started coaster service:" ${OUT} ) )
+   if [[ ${#LINE} == 0 ]] then
+     grep Error ${OUT} >& /dev/null && return 1
+     sleep 3
+   else
+     break
+   fi
+  done
+  [[ ${#LINE} == 0 ]] && return 1
+
+  CONTACT=${LINE[-1]}
+  print ${CONTACT}
+  return 0
+}
+
+# Obtain the URL to which the workers should connect
+get_service_local()
+{
+  local OUT=$1
+  LINE=()
+  COUNT=0
+  for COUNT in {1..4}
+  do
+   LINE=( $( grep "Passive queue processor" ${OUT} ) )
+   if [[ ${#LINE} == 0 ]] then
+     sleep 4
+   else
+     break
+   fi
+   if grep "Error" ${OUT} >& /dev/null
+     then
+     print "coaster-service error!" >&2
+     cat ${OUT} >&2
+     return 1
+   fi
+  done
+  [[ ${#LINE} == 0 ]] && return 1
+
+  CONTACT=${LINE[-1]}
+  print ${CONTACT}
+  return 0
+}
+
+SIGNALS="EXIT INT QUIT"
+cleanup_trap()
+{
+  print "cleanup_trap()..."
+  eval trap - ${SIGNALS}
+  [[ ${COASTER_SERVICE_PID} != "" ]] && kill ${COASTER_SERVICE_PID}
+  [[ ${STARTWORKERS_PID}    != "" ]] && kill ${START_WORKERS_PID}
+}
+# eval trap cleanup_trap ${SIGNALS}
+
+SERVICE_LOG=${LOGDIR}/coaster-service.log
+coaster-service -nosec -p ${SERVICE_PORT} >& ${SERVICE_LOG} &
+COASTER_SERVICE_PID=${!}
+
+sleep 1
+
+SERVICE_COASTERS=$( get_service_coasters ${SERVICE_LOG} )
+exitcode "Could not get coasters service!"
+export SERVICE_COASTERS
+
+source setup.sh
+exitcode "setup.sh failed!"
+
+sleep 1
+
+{ ${SWIFT} -config swift.properties \
+           -sites.file sites.passivate.xml \
+           -tc.file tc.passivate.data \
+           passivate.swift < /dev/null >& ${SWIFT_OUT}
+  exitcode "Swift failed!"
+  print "Swift finished."
+} &
+SWIFT_PID=${!}
+
+sleep 1
+
+pwd
+SERVICE_LOCAL=$( get_service_local ${SWIFT_OUT} )
+exitcode "get_service_local failed!"
+export SERVICE_LOCAL
+
+sleep 1
+
+print "Starting workers..."
+start_workers ${SERVICE_LOCAL} &
+START_WORKERS_PID=${!}
+
+sleep 1
+
+exit 0




More information about the Swift-commit mailing list