mirror of
https://github.com/go-gitea/gitea
synced 2024-11-16 07:04:25 +00:00
2dd4ab65c7
now, we auto add the start.sh -> /usr/bin/gogs_start, then supervisor needn’t the full path, detail please see the commit. and how to use: entry gogs root path, then input scripts/gogs_supervisord.sh restart (add sudo if need)
47 lines
753 B
Bash
Executable File
47 lines
753 B
Bash
Executable File
#!/bin/sh
|
|
|
|
PID="log/supervisord.pid"
|
|
CONF="etc/supervisord.conf"
|
|
|
|
EXEPATH='/usr/bin/gogs_start'
|
|
if [ ! -f $EXEPATH ]; then
|
|
gogs_scripts_path=$(cd `dirname $0`; pwd)
|
|
echo $gogs_scripts_path
|
|
sudo ln -s $gogs_scripts_path'/start.sh' /usr/bin/gogs_start
|
|
fi
|
|
|
|
LOGDIR="log"
|
|
if [ ! -d $LOGDIR ]; then
|
|
mkdir $LOGDIR
|
|
fi
|
|
|
|
stop() {
|
|
if [ -f $PID ]; then
|
|
kill `cat -- $PID`
|
|
rm -f -- $PID
|
|
echo "stopped"
|
|
fi
|
|
}
|
|
|
|
start() {
|
|
echo "starting"
|
|
if [ ! -f $PID ]; then
|
|
supervisord -c $CONF
|
|
echo "started"
|
|
fi
|
|
}
|
|
|
|
case "$1" in
|
|
start)
|
|
start
|
|
;;
|
|
stop)
|
|
stop
|
|
;;
|
|
restart)
|
|
stop
|
|
start
|
|
;;
|
|
*)
|
|
echo "Usage: $0 {start|stop|restart}"
|
|
esac |