#!/bin/sh
#
if [ -f /etc/uls/uls.conf ]
 then
  . /etc/uls/uls.conf
elif [ -f /etc/uls.conf ]
 then
  . /etc/uls.conf
fi
#
if [ "$ULSSERVER" = "STORE" ]
 then
  if [ -z "$ULS_STORE_PATH" ]
   then
    ULS_STORE_PATH=${ULS_TMP_PATH:-/var/tmp/uls}
  else
    SENDWAIT=10
  fi
  TMPDIR="$ULS_STORE_PATH.$$"
  mv "$ULS_STORE_PATH" "$TMPDIR"
  mkdir -m 1777 -p "$ULS_STORE_PATH"
  sleep ${SENDWAIT:-10}
  if cd "$TMPDIR"
   then
    tar cf - . | gzip -1
  fi
  cd /
  sleep 1
  rm -rf "$TMPDIR"
fi
