ref: ec7858e8571481b21ae71ebade984c6a9444f9dc
script/service.sh
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
#! /bin/bash # # Yats - yats # # This file is licensed under the Affero General Public License version 3 or # later. See the COPYING file. # # Author: Paolo Lulli <kevwe.com> # Copyright: Paolo Lulli 2024 # cd $(dirname $0) EXECUTABLE=../server/yats-server instance="default" if [ "$#" = "2" ]; then instance=$1 operation=$2 else operation=$1 fi if [ "$#" -lt "1" ]; then echo "Usage $0 <name> <start|stop>" exit 1 fi PIDFILE=~/yats-${instance}.pid if [ "$operation" = "stop" ]; then PID2K=$(cat $PIDFILE) kill -9 $PID2K && rm $PIDFILE exit 0 fi test -f $PIDFILE && echo PID file exist test -f $PIDFILE && exit 1 export GIN_MODE=release ${EXECUTABLE} ${instance} & echo $! > $PIDFILE |