#!/bin/bash

case $1 in
  start)
    echo "Starting JuicePay2 web app..."
    /opt/JuicePay2/JuicePay2 -config /opt/JuicePay2/config.toml 2> /var/log/JuicePay2.log &
    ;;
  stop)
    echo "Stopping JuicePay2 web app..."
    kill $(lsof -t -i:8080)
    ;;
  *)
    echo "JuicePay2 web app service."
    echo $"Usage $0 {start|stop}"
    exit 1
esac
exit 0
