加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
gogs 1.14 KB
一键复制 编辑 原始数据 按行查看 历史
qioixiy 提交于 2021-12-18 23:54 . Update 51_data
#!/bin/sh
NAME=gogs
DESC=gogs
SCRIPT_DIR=$(cd $(dirname $0) && pwd)
source ./config
start_gogs() {
# Start the daemon/service
#
# Returns:
# 0 if gogs has been started
# 1 if gogs was already running
# 2 if gogs could not be started
docker run --restart always -d --name=gogs -v $GOGS_DATADIR:/data -p 8094:3000 -p 10022:22 -d gogs/gogs > /dev/null \
|| return 0
}
restart_gogs() {
docker restart gogs
}
stop_gogs() {
# Stops the daemon/service
#
# Return
# 0 if gogs has been stopped
# 1 if gogs was already stopped
# 2 if gogs could not be stopped
# other if a failure occurred
docker stop gogs
sleep 1
return 0
}
clean_gogs() {
docker rm -f gogs
}
logs_gogs() {
docker logs gogs
return 0
}
case "$1" in
start)
echo "Starting $DESC" "$NAME"
start_gogs
case "$?" in
esac
;;
stop)
echo "Stopping $DESC" "$NAME"
stop_gogs
case "$?" in
esac
;;
restart)
echo "Restarting $DESC" "$NAME"
restart_gogs
;;
logs)
logs_gogs
;;
clean)
clean_gogs
;;
*)
echo "Usage: $NAME {start|stop|restart|logs|clean}" >&2
exit 3
;;
esac
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化