gogs设置开机自启服务 - Go语言中文社区

gogs设置开机自启服务


$ sudo cp /gogs/scripts/systemd/gogs.service /lib/systemd/system/
$ sudo vi /lib/systemd/system/gogs.service
--------------------------------

$ cat /lib/systemd/system/gogs.service
[Unit]
Description=Gogs
After=syslog.target
After=network.target
#After=mariadb.service mysqld.service postgresql.service memcached.service redis.service

[Service]
# Modify these two values and uncomment them if you have
# repos with lots of files and get an HTTP error 500 because
# of that
###
#LimitMEMLOCK=infinity
#LimitNOFILE=65535
Type=simple
User=user_name
Group=user_group
WorkingDirectory=/home/user_name/tools/gogs
ExecStart=/home/user_name/tools/gogs/gogs web
Restart=always
Environment=USER=user HOME=/home/user

# Some distributions may not support these hardening directives. If you cannot start the service due
# to an unknown option, comment out the ones not supported by your version of systemd.
ProtectSystem=full
PrivateDevices=yes
PrivateTmp=yes
NoNewPrivileges=true

[Install]
WantedBy=multi-user.target
--------------------------------

$ sudo systemctl daemon-reload
$ sudo systemctl enable gogs
--------------------------------
版权声明:本文来源博客园,感谢博主原创文章,遵循 CC 4.0 by-sa 版权协议,转载请附上原文出处链接和本声明。
原文链接:https://www.cnblogs.com/Serendipity2020/p/13475609.html
站方申明:本站部分内容来自社区用户分享,若涉及侵权,请联系站方删除。
  • 发表于 2021-05-31 18:15:06
  • 阅读 ( 1744 )
  • 分类:Go

0 条评论

请先 登录 后评论

官方社群

GO教程

猜你喜欢