53 lines
1.0 KiB
Markdown
53 lines
1.0 KiB
Markdown
|
|
# systemd service file
|
||
|
|
> `application.service`
|
||
|
|
> ```
|
||
|
|
[Unit]
|
||
|
|
Description=Gogs (Go Git Service)
|
||
|
|
After=syslog.target
|
||
|
|
After=network.target
|
||
|
|
#After=postgresql.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=git
|
||
|
|
Group=git
|
||
|
|
|
||
|
|
WorkingDirectory=/apps/gogs
|
||
|
|
ExecStart=/apps/gogs/gogs web
|
||
|
|
Restart=always
|
||
|
|
Environment=USER=git HOME=/home/git
|
||
|
|
|
||
|
|
[Install]
|
||
|
|
WantedBy=multi-user.target
|
||
|
|
```
|
||
|
|
|
||
|
|
|
||
|
|
## Copy config to systemd
|
||
|
|
> sudo cp ./gogs.service /etc/systemd/system
|
||
|
|
>
|
||
|
|
> sudo systemctl daemon-reload
|
||
|
|
|
||
|
|
## Start a service
|
||
|
|
> sudo systemctl start application.service
|
||
|
|
|
||
|
|
## Stop a service
|
||
|
|
> sudo systemctl stop application.service
|
||
|
|
|
||
|
|
## Restart a service
|
||
|
|
> sudo systemctl restart application.service
|
||
|
|
|
||
|
|
## To start a service at boot
|
||
|
|
> sudo systemctl enable application.service
|
||
|
|
|
||
|
|
## Disable a service starting at boot
|
||
|
|
> sudo systemctl disable application.service
|
||
|
|
|
||
|
|
## Check Status of a service
|
||
|
|
> systemctl status application.service
|