github.com/line/ostracon@v1.0.10-0.20230328032236-7f20145f065d/networks/local/localnode/wrapper.sh (about)

     1  #!/usr/bin/env sh
     2  
     3  ##
     4  ## Input parameters
     5  ##
     6  BINARY=/ostracon/${BINARY:-ostracon}
     7  ID=${ID:-0}
     8  LOG=${LOG:-ostracon.log}
     9  
    10  ##
    11  ## Assert linux binary
    12  ##
    13  if ! [ -f "${BINARY}" ]; then
    14  	echo "The binary $(basename "${BINARY}") cannot be found. Please add the binary to the shared folder. Please use the BINARY environment variable if the name of the binary is not 'ostracon' E.g.: -e BINARY=ostracon_my_test_version"
    15  	exit 1
    16  elif ! [ -x "${BINARY}" ]; then
    17  	echo "The binary $(basename "${BINARY}") is not executable."
    18  	exit 1
    19  fi
    20  
    21  ##
    22  ## Run binary with all parameters
    23  ##
    24  export OCHOME="/ostracon/node${ID}"
    25  
    26  if [ -d "`dirname ${OCHOME}/${LOG}`" ]; then
    27    "$BINARY" "$@" | tee "${OCHOME}/${LOG}"
    28  else
    29    "$BINARY" "$@"
    30  fi
    31  
    32  chmod 777 -R /ostracon
    33