mirror of
https://github.com/TeaOSLab/EdgeAPI.git
synced 2025-11-03 23:20:26 +08:00
改进细节
This commit is contained in:
@@ -3,8 +3,9 @@ package main
|
|||||||
import (
|
import (
|
||||||
"flag"
|
"flag"
|
||||||
"github.com/TeaOSLab/EdgeAPI/internal/utils"
|
"github.com/TeaOSLab/EdgeAPI/internal/utils"
|
||||||
"net"
|
"github.com/iwind/gosock/pkg/gosock"
|
||||||
"os"
|
"os"
|
||||||
|
"os/exec"
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
@@ -24,11 +25,21 @@ func main() {
|
|||||||
stderr("need '-cmd=COMMAND' argument")
|
stderr("need '-cmd=COMMAND' argument")
|
||||||
} else if cmd == "test" {
|
} else if cmd == "test" {
|
||||||
// 检查是否正在运行
|
// 检查是否正在运行
|
||||||
path := os.TempDir() + "/edge-dns.sock"
|
var sock = gosock.NewTmpSock("edge-dns")
|
||||||
conn, err := net.Dial("unix", path)
|
if sock.IsListening() {
|
||||||
if err == nil {
|
// 从systemd中停止
|
||||||
_ = conn.Close()
|
systemctl, _ := exec.LookPath("systemctl")
|
||||||
stderr("test dns node status: edge dns node is running now, can not install again")
|
if len(systemctl) > 0 {
|
||||||
|
systemctlCmd := exec.Command(systemctl, "stop", "edge-dns")
|
||||||
|
_ = systemctlCmd.Run()
|
||||||
|
}
|
||||||
|
|
||||||
|
// 从进程中停止
|
||||||
|
if sock.IsListening() {
|
||||||
|
_, _ = sock.Send(&gosock.Command{
|
||||||
|
Code: "stop",
|
||||||
|
})
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else if cmd == "unzip" { // 解压
|
} else if cmd == "unzip" { // 解压
|
||||||
if len(zipPath) == 0 {
|
if len(zipPath) == 0 {
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
package teaconst
|
package teaconst
|
||||||
|
|
||||||
const (
|
const (
|
||||||
Version = "0.2.8.2"
|
Version = "0.2.9"
|
||||||
|
|
||||||
ProductName = "Edge API"
|
ProductName = "Edge API"
|
||||||
ProcessName = "edge-api"
|
ProcessName = "edge-api"
|
||||||
|
|||||||
@@ -90,7 +90,7 @@ func (this *HTTPAccessLogDAO) CreateHTTPAccessLogsWithDAO(tx *dbs.Tx, daoWrapper
|
|||||||
|
|
||||||
// TODO 根据集群、服务设置获取IP
|
// TODO 根据集群、服务设置获取IP
|
||||||
if tableDef.HasRemoteAddr {
|
if tableDef.HasRemoteAddr {
|
||||||
fields["remoteAddr"] = accessLog.RawRemoteAddr
|
fields["remoteAddr"] = accessLog.RemoteAddr
|
||||||
}
|
}
|
||||||
if tableDef.HasDomain {
|
if tableDef.HasDomain {
|
||||||
fields["domain"] = accessLog.Host
|
fields["domain"] = accessLog.Host
|
||||||
|
|||||||
Reference in New Issue
Block a user