ahitrin commented on code in PR #3210:
URL: https://github.com/apache/ignite-3/pull/3210#discussion_r1489082512


##########
packaging/zip/ignite3db:
##########
@@ -34,14 +38,26 @@ cd ${IGNITE_HOME} || exit
 start() {
   echo "Starting Ignite 3..."
 
+  STARTUP_LOG_FILE="${LOG_DIR}/ignite3db-startup.log"
+
   CMD="${JAVA_CMD_WITH_ARGS} ${APPLICATION_ARGS}"
-  $CMD >>/dev/null 2>&1 </dev/null & echo $! >${IGNITE_HOME}/pid
+  $CMD >>"${STARTUP_LOG_FILE}" 2>&1 </dev/null & echo $! >${IGNITE_HOME}/pid
 
   rest_address_file=${WORK_DIR}/rest-address
-  while [ ! -f "$rest_address_file" ]; do sleep 0.5; done
-    rest_address=$(cat "$rest_address_file")
+  count=0
+  max_attempts=60 # 30 seconds, considering sleep of 0.5s
+  while [ ! -f "$rest_address_file" ] && [ "$count" -lt "$max_attempts" ]; do
+    sleep 0.5
+    ((count++))
+  done
 
-  echo "Node named ${NODE_NAME} started successfully. REST addresses are 
[$rest_address]"
+ if [ ! -f "$rest_address_file" ]; then
+     echo "Failure: Application did not start within the expected time frame." 
>&2

Review Comment:
   Probably, a mention of `$STARTUP_LOG_FILE` could be useful here. WDYT?



##########
packaging/zip/ignite3db:
##########
@@ -16,6 +16,10 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 #
+set -o errexit # Exit on error
+set -o nounset # Exit on unset variables
+set -o pipefail # Exit if any command in a pipeline fails

Review Comment:
   A situation with `pipefail` in non-bash shells is 
[controversal](https://unix.stackexchange.com/questions/654885/who-is-responsible-for-providing-set-o-pipefail/654932).
 Some shells, especially in legacy environments (even POSIX `sh`), may not 
support it. I'm afraid it may be risky to use `/bin/sh` as a shebang with it.
   
   Probably, a `/bin/bash` or `/usr/bin/env bash` shebang is more preferrable 
now.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to