gogs / gogs/gogs

Centos7设置开机启动失败

Open
#4,757 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Go
Stars
47.8k
Forks
5.1k
Avg merge
7h 23m
Merged PRs (30d)
5

Description

gogs最新版(0.11.29)二进制安装 ,在Centos7上配置开机启动,脚本如下:
#!/bin/bash

# chkconfig: 3 10 90

# description: myservice ....

SERVERNAME="GoGs"

start()
{
echo "start $SERVERNAME"

/home/git/mysql-5.7.19/startMysql.sh &
sleep 7s
nohup /home/git/gogs-0.11.29/gogs web > /home/git/gogs-0.11.29/log/gogo_web.log 2>&1 &
echo "start $SERVERNAME ok!"
exit 0;

}

stop()
{
echo "stop $SERVERNAME"

/home/git/mysql-5.7.19/stopMysql.sh &
sleep 5s
kill -9 $(pidof gogs)

echo "stop $SERVERNAME ok!"

}

case "$1" in
start)
start
;;
stop)
stop
;;
restart)
stop
sleep 5s
start
;;
*)
echo "usage: $0 start|stop|restart"
exit 0;
esac
exit
文件名为:gogs 放入目录:/etc/init.d
配置开机启动: chkconfig --add gogs
chkconfig gogs on

mysql 可以启动,gogs报错!如下:
[FATAL] [...g/setting/setting.go:430 NewContext()] Fail to get home directory: Cannot specify home directory because it's empty

终端执行如下命令可正常启动:
nohup /home/git/gogs-0.11.29/gogs web > /home/git/gogs-0.11.29/log/gogo_web.log 2>&1 &

试了这个:https://github.com/gogits/gogs/blob/master/scripts/init/centos/gogs#L43 也不行,daemon 命令不存在,安装了几个都不对,放弃了
那位大神帮忙解决下!

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with setting/setting.go:430 and the reported /etc/init.d/gogs script, then compare it with scripts/init/centos/gogs. Reproduce the CentOS 7 boot-start failure and determine why the home directory is empty; done means the Gogs service starts successfully during boot without the reported fatal error.

Written by the indexing model from the issue text.

Assessment

Tech stack
bash, centos, go, mysql
Domain
backend, operating-systems
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.