gitea/scripts/start

23 lines
529 B
Plaintext
Raw Normal View History

#!/bin/bash
DIR="$(dirname "$(cd "$(dirname "$(readlink -f "$0")")";pwd -P)")"|| exit
COMMAND=$DIR/scripts/run "$@"
echo $DIR $COMMAND
PIDFILE="$DIR/gitea.pid"
# echo $PIDFILE
# read -r PID < $PIDFILE
# echo PID $PID
# echo "$(ps -ea | grep $PID)"
if [ -e ${PIDFILE} ]; then
read -r PID < $PIDFILE
if (ps -ea | grep $PID); then
echo "start aborted gitea is already running."
exit 1;
fi
fi
echo starting gitea sending log to gitea.log
$COMMAND > $DIR/gitea.log &
echo PID of gitea process is $!
echo $! > $PIDFILE