#!/usr/bin/env bash
#
# Copyright (C) 2003 VA Linux Systems Japan, K.K.
#
# LICENSE NOTICE
#
#  This program is free software; you can redistribute it and/or modify
#  it under the terms of the GNU General Public License as published by
#  the Free Software Foundation; either version 2 of the License, or
#  (at your option) any later version.
#
#  This program is distributed in the hope that it will be useful,
#  but WITHOUT ANY WARRANTY; without even the implied warranty of
#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#  GNU General Public License for more details.
#

set -e

eval `ultrapossum-config init`
trap "eval `ultrapossum-config term`" 0

if ! test -f "$ULTRAPOSSUMRUN"; then

  if test "x`$MODULEDIR/server/startup status`" = "xrunning"; then
    echo "E: server is running but no runtime status file found" 1>&2
  else
    echo "E: server is not running" 1>&2
  fi
  exit 1
fi

if ! test -r "$ULTRAPOSSUMRUN"; then
  echo "E: no permission to read server runtime status" 1>&2
  exit 1
fi
. "$ULTRAPOSSUMRUN"

for a in "$@"
do
  echo $a=\"${!a}\"
done
