#!/bin/bash

echo "================================================================================"
echo "RESTART PULT.ONLINE SERVICES"

if [[ "$1" == "-h" ]] || [[ "$1" == "--help" ]] || [[ "$1" == "?" ]]; then
  echo "Usage: ./restart | [<service1[,<service2>...]> | -<service1[,<service2>...]>]"
  echo "Exmpl: ./restart                      - restarts all"
  echo "       ./restart gateway,modbusrtu    - restarts only gateway and modbusrtu"
  echo "       ./restart -modbusrtu           - restarts all except modbusrtu"
else
  (./services/supervisor/pult_supervisor >/dev/null 2>&1 )&
  ./services/rpcconsole/pult_rpcconsole restart "$@"
fi
echo "================================================================================"
