gitearmbian/gitea.services.sh
titor-z faa346ebed armbian-0.1.0
已经经过打包测试的第一版
2024-10-18 16:29:24 +08:00

48 lines
943 B
Bash

#!/bin/sh
### BEGIN INIT INFO
# Provides: gitea
# Required-Start: $local_fs $network
# Required-Stop: $local_fs
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Gitea service
### END INIT INFO
GITEA_PATH="/usr/local/bin/gitea"
GITEA_USER="git"
GITEA_DIR="/var/lib/gitea/"
case "$1" in
start)
echo "Starting Gitea..."
su - $GITEA_USER -c "$GITEA_PATH web --work-path=/var/lib/gitea --config=/var/lib/gitea/custom/conf/app.ini
"
;;
stop)
echo "Stopping Gitea..."
pid=$(pgrep -f "gitea web")
if [ -n "$pid" ]; then
kill $pid
fi
;;
restart)
$0 stop
sleep 1
$0 start
;;
status)
pid=$(pgrep -f "gitea web")
if [ -n "$pid" ]; then
echo "Gitea is running with PID $pid."
else
echo "Gitea is not running."
fi
;;
*)
echo "Usage: /etc/init.d/gitea {start|stop|restart|status}"
exit 1
;;
esac
exit 0