mirror of
https://codeberg.org/forgejo/forgejo
synced 2024-11-24 18:56:11 +01: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 |