在gogs的release包中,linux_amd64.zip这个包里,scripts目录下没有start.sh这个文件,因此在 执行./scripts/gogs_supvisor.sh文件的时候会直接后/usr/local/bin/gogs_start文件不存在

打开这个gogs_supvisor.sh文件后,发现他会判断/usr/local/bin/gogs_start文件是否存在,如果不存在就将./scripts/start.sh文件复制 过去并改为为gogs_start

然而,scripts目录下并没有这个start.sh文件,这个问题在官方的issue中已经提出并有解决方案:https://github.com/gogits/gogs/issues/1198

解决方案就是:

oh man sorry for that.

I would suggest install supervisor as init.d somehow doesn't worked for me after trying lot of diffrent combinations. to do that,

sudo apt-get -y install supervisor

and edit its file via

sudo nano /etc/supervisor/supervisord.conf

[program:gogs]
directory=/home/git/go/src/github.com/gogits/gogs/
command=/home/git/go/src/github.com/gogits/gogs/gogs web
autostart=true
autorestart=true
startsecs=10
stdout_logfile=/var/log/gogs/stdout.log
stdout_logfile_maxbytes=1MB
stdout_logfile_backups=10
stdout_capture_maxbytes=1MB
stderr_logfile=/var/log/gogs/stderr.log
stderr_logfile_maxbytes=1MB
stderr_logfile_backups=10
stderr_capture_maxbytes=1MB
environment = HOME="/home/git", USER="git"

change directory's to match your installation and user to your git user. and restart the supervisor via,
sudo service supervisor restart

that's all you need to make gogs start automatically on boot.

看上述内容,修改一下supervisor的配置,加入gogs的配置,注意修改成你自己的路径即可