#!/bin/bash
#
# sccl
#
# calling script for sccl scripts
####################################################
#
SCCL=${0##*/}
if [[ $# -lt 1 ]]; then
  echo "usage $SCCL <program> [<pars>...]
      $SCCL -?|--help|-V|-v|-vv"
  exit 1
fi
#
if [[ $1 = '-V' ]]; then
  ${0%/*}/sccl_node -v
elif [[ $1 = '-?' || $1 == -v* || $1 = '--help' ]]; then
  echo "usage $SCCL <program> [<pars>...]
      $SCCL -?|--help|-V|-v|-vv
  programs:
    2_uls
    disable
    disable_node
    enable
    enable_node
    restart
    show_cluster
    start
    start_node
    stop
    stop_node
    reload"
  if [[ $1 == *v* || $2 == -v* ]]; then
    echo "    add_node
    check_config
    create_cluster
    dist_config
    join_cluster
    remove_node"
    if [[ $1 == *vv* || $2 = '-vv' ]]; then
      echo "    get_actnode
    kill
    list_cluster
    list_cluster_nodes
    list_nodes
    list_packages_on_node
    reset_passwords
    restart_u2w
    test_package
    test_res
    update_ips"
    fi
  fi
else
  BASE="${0%/*}/sccl_"
  PRG=$1
  if [[ -x $BASE$PRG ]]; then
    shift
    $BASE$PRG "$@"
  else
    echo "ERROR: $PRG is no sccl command"
  fi
fi
