#!/bin/sh

export PATH=/usr/bin:/usr/sbin:$PATH


printUsage() {
  echo "$0 is commandline wrapper to execute file copy to remote system"
  echo "where remote system is given as first argument"
  echo ""
  echo "$0 [-h] [-p] [-c] [-t ssh_timeout_in_sec] <host> <local_path> <remote_path>"
}

if [ "$#" == "0" ]
then
  printUsage; exit 1;
fi

option=""
# evaluate options
while getopts "pct:" OPTION; do
    case $OPTION in
    p)
      option="${option} --nodecheck=ping";
      ;;
    c)
      option="${option} --nodecheck=crm";
      ;;
    t)
      option="${option} --sshlock_timeout=${OPTARG}";
      ;;
    esac
done
shift $(($OPTIND - 1))

WS_BASE=/opt/webservice
${WS_BASE}/scripts/swupdated put ${option} "$1" "$2" "$3"

