#!/bin/sh
BOOTSTRAP_DIR=/usr/local/sng/var/bootstrap
BOOTSTRAP_FILES=`ls ${BOOTSTRAP_DIR}/[0-9][0-9][0-9]-*.bootstrap | sort -n`
mkdir -p $BOOTSTRAP_DIR

for file in $BOOTSTRAP_FILES
do
  BOOTSTRAP_DONE=${file}.done

  if [ ! -f $BOOTSTRAP_DONE ]; then
    $file > ${file}.log 2>&1
    RC=$?
    if [ $RC -eq 0 ]; then
      touch $BOOTSTRAP_DONE
      STATE="DONE"
    else
      STATE="ERROR ${RC}"
    fi
  else
    STATE="SKIP"
  fi
  logger "Bootstrap - ${file} - ${STATE}"
done


