#!/bin/sh
# CrossFTP commander. For more information, please refer to http://www.crossftp.com
# Attention: please use absolute path in the input parameters.
# To encrypt/decrypt, make sure you have Java Cryptography Extension (JCE) Unlimited Strength Jurisdiction Policy Files installed on JDK.
# Sample Usage:
# commander.sh [--action <addSite/listSites/editSite/deleteSite/copy/move/sync/delete/registerLicense/releaseLicense/config/encrypt/decrypt>] [--configDir <PATH_TO_CONFIG_FOLDER>] [--help]
# You can use --help to get the specific command line usage for each type of action.
# addSite example:
# commander.sh --configDir /Users/username/.crossftp --action addSite --siteId test --protocol ftp --host test.com
# copy example:
# commander.sh --configDir /Users/username/.crossftp --action copy --sourceSite MyComputer --sourceDirectory /Users/username/Downloads/test --targetSite targetSiteId --targetDirectory /Users/username/incoming/test --threadNumber=2

#
# Get the Java command
#
if [ -z "$JAVACMD" ] ; then
  if [ -n "$JAVA_HOME"  ] ; then
    if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
      # IBM's JDK on AIX uses strange locations for the executables
      JAVACMD="$JAVA_HOME/jre/sh/java"
    else
      JAVACMD="$JAVA_HOME/bin/java"
    fi
  else
    JAVACMD=`which java 2> /dev/null `
    if [ -z "$JAVACMD" ] ; then
        JAVACMD=java
    fi
  fi
fi

if [ ! -x "$JAVACMD" ] ; then
  echo "Error: JAVA_HOME is not defined correctly."
  echo "  We cannot execute $JAVACMD"
  exit 1
fi


$JAVACMD -cp crossftp.jar:crossftp-resources.jar:commons-logging.jar:jnlp.jar:looks-2.2.1.jar:bcprov-jdk15on-147.jar crossftp.common.Commander $@
