gogs后台守护运行

后台脚本 在%GOGS_HOME%/scripts目录下,已经包含了各个系统的脚本,只需要稍微修改即可添加到自启动。

root@iZ2ze9hvf7pey4vrxv9r8gZ:/usr/local/gogs# tree scripts/
scripts/
├── autoboot.sh
├── build_freebsd.sh
├── build_linux64.sh
├── build.sh
├── init
│   ├── centos
│   │   └── gogs
│   ├── debian
│   │   └── gogs
│   ├── freebsd
│   │   └── gogs
│   ├── gentoo
│   │   └── gogs
│   ├── openbsd
│   │   └── gogs
│   └── suse
│       └── gogs
├── launchd
│   └── io.gogs.web.plist
├── mysql.sql
├── README
├── supervisor
│   └── gogs
├── systemd
│   └── gogs.service
└── windows
    └── install-as-service.bat

以Ubuntu16、gogs-v0.11.34.1122为例:

复制脚本并赋予执行权限

cp scripts/init/debian/gogs /etc/init.d/
chmod +x /etc/init.d/gogs
cp scripts/systemd/gogs.service /lib/systemd/system/
chmod +x /lib/systemd/system/gogs.service

修改配置

/etc/init.d/gogs /etc/init.d/gogs /lib/systemd/system/gogs.service /lib/systemd/system/gogs.service

启动

service gogs restart

或者

/etc/init.d/gogs restart