增加自动安装脚本

This commit is contained in:
2026-04-09 17:51:11 +08:00
parent 4a4bd8f67c
commit 6df84b0584
4 changed files with 765 additions and 12 deletions
+29
View File
@@ -0,0 +1,29 @@
[Unit]
Description=Go API Server
After=network.target mysql.service
Wants=mysql.service
[Service]
Type=simple
User=root
Group=root
WorkingDirectory=/www/wwwroot/api.yunzer.cn
ExecStart=/usr/local/go/bin/go run main.go
Restart=always
RestartSec=5
StandardOutput=append:/www/wwwroot/api.yunzer.cn/go.log
StandardError=append:/www/wwwroot/api.yunzer.cn/go.log
# 环境变量
Environment="PATH=/usr/local/go/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
# 资源限制
LimitNOFILE=65535
LimitNPROC=65535
# 安全设置
PrivateTmp=true
NoNewPrivileges=false
[Install]
WantedBy=multi-user.target