mirror of
https://github.com/oneclickvirt/ecs.git
synced 2025-09-29 04:32:11 +08:00
Compare commits
4 Commits
Author | SHA1 | Date | |
---|---|---|---|
![]() |
f6dd0bbb56 | ||
![]() |
01686f3e9d | ||
![]() |
5a6cd7d671 | ||
![]() |
35e183b640 |
@@ -27,4 +27,8 @@ Shell版本: https://github.com/spiritLHLS/ecs
|
|||||||
|
|
||||||
## 说明
|
## 说明
|
||||||
|
|
||||||
开发中,勿要使用
|
开发中,勿要使用
|
||||||
|
|
||||||
|
```
|
||||||
|
curl -L https://raw.githubusercontent.com/oneclickvirt/ecs/master/goecs.sh -o goecs.sh && chmod +x goecs.sh
|
||||||
|
```
|
2
go.mod
2
go.mod
@@ -15,7 +15,7 @@ require (
|
|||||||
github.com/oneclickvirt/memorytest v0.0.1-20240624151629
|
github.com/oneclickvirt/memorytest v0.0.1-20240624151629
|
||||||
github.com/oneclickvirt/nt3 v0.0.2-20240630152642
|
github.com/oneclickvirt/nt3 v0.0.2-20240630152642
|
||||||
github.com/oneclickvirt/portchecker v0.0.1-20240624155429
|
github.com/oneclickvirt/portchecker v0.0.1-20240624155429
|
||||||
github.com/oneclickvirt/security v0.0.2-20240630142358
|
github.com/oneclickvirt/security v0.0.3-20240701065755
|
||||||
github.com/oneclickvirt/speedtest v0.0.6-20240630114816
|
github.com/oneclickvirt/speedtest v0.0.6-20240630114816
|
||||||
)
|
)
|
||||||
|
|
||||||
|
4
go.sum
4
go.sum
@@ -97,8 +97,8 @@ github.com/oneclickvirt/nt3 v0.0.2-20240630152642 h1:BkpR1j9JaDxMzx7iIwtsnFDxSld
|
|||||||
github.com/oneclickvirt/nt3 v0.0.2-20240630152642/go.mod h1:UojPmtangn17TiQaDccVrZbn6sZwJOtzBgg3idp68cA=
|
github.com/oneclickvirt/nt3 v0.0.2-20240630152642/go.mod h1:UojPmtangn17TiQaDccVrZbn6sZwJOtzBgg3idp68cA=
|
||||||
github.com/oneclickvirt/portchecker v0.0.1-20240624155429 h1:+wapaOcFrg1iWJDhBKThDzppyIMY7hWxK7F5RBkZg4o=
|
github.com/oneclickvirt/portchecker v0.0.1-20240624155429 h1:+wapaOcFrg1iWJDhBKThDzppyIMY7hWxK7F5RBkZg4o=
|
||||||
github.com/oneclickvirt/portchecker v0.0.1-20240624155429/go.mod h1:HQxSTrqM8/QFqHMTBZ7S8H9eEO5FkUXU1eb7ZX5Mk+k=
|
github.com/oneclickvirt/portchecker v0.0.1-20240624155429/go.mod h1:HQxSTrqM8/QFqHMTBZ7S8H9eEO5FkUXU1eb7ZX5Mk+k=
|
||||||
github.com/oneclickvirt/security v0.0.2-20240630142358 h1:yioMtHuW9wbJ7payL8GCPnj1ScEqNoqbNHt3+4Z4VAg=
|
github.com/oneclickvirt/security v0.0.3-20240701065755 h1:eHZDuyvzufOu2yDUIMggK2iRtMWJaFlCzG4+leQn5+0=
|
||||||
github.com/oneclickvirt/security v0.0.2-20240630142358/go.mod h1:cUNNOldoVQuovyc0EtAVAZlAT4y2xA1e0uA80aj1ly8=
|
github.com/oneclickvirt/security v0.0.3-20240701065755/go.mod h1:cUNNOldoVQuovyc0EtAVAZlAT4y2xA1e0uA80aj1ly8=
|
||||||
github.com/oneclickvirt/speedtest v0.0.6-20240630114816 h1:gI2hqV0IwcvGqYzLhlt4w2oZvYhCL+73jftUuJYBsuI=
|
github.com/oneclickvirt/speedtest v0.0.6-20240630114816 h1:gI2hqV0IwcvGqYzLhlt4w2oZvYhCL+73jftUuJYBsuI=
|
||||||
github.com/oneclickvirt/speedtest v0.0.6-20240630114816/go.mod h1:zd5ZgIGslmtQLQehEfRjyumlvgDHTpCSMchKfKXoASI=
|
github.com/oneclickvirt/speedtest v0.0.6-20240630114816/go.mod h1:zd5ZgIGslmtQLQehEfRjyumlvgDHTpCSMchKfKXoASI=
|
||||||
github.com/onsi/ginkgo/v2 v2.19.0 h1:9Cnnf7UHo57Hy3k6/m5k3dRfGTMXGvxhHFvkDTCTpvA=
|
github.com/onsi/ginkgo/v2 v2.19.0 h1:9Cnnf7UHo57Hy3k6/m5k3dRfGTMXGvxhHFvkDTCTpvA=
|
||||||
|
19
goecs.go
19
goecs.go
@@ -18,15 +18,18 @@ import (
|
|||||||
gostunmodel "github.com/oneclickvirt/gostun/model"
|
gostunmodel "github.com/oneclickvirt/gostun/model"
|
||||||
"github.com/oneclickvirt/portchecker/email"
|
"github.com/oneclickvirt/portchecker/email"
|
||||||
speedtestmodel "github.com/oneclickvirt/speedtest/model"
|
speedtestmodel "github.com/oneclickvirt/speedtest/model"
|
||||||
|
"os"
|
||||||
|
"os/signal"
|
||||||
"regexp"
|
"regexp"
|
||||||
"runtime"
|
"runtime"
|
||||||
"strings"
|
"strings"
|
||||||
"sync"
|
"sync"
|
||||||
|
"syscall"
|
||||||
"time"
|
"time"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
ecsVersion = "2024.07.01.1"
|
ecsVersion = "v0.0.19"
|
||||||
menuMode bool
|
menuMode bool
|
||||||
input, choice string
|
input, choice string
|
||||||
showVersion bool
|
showVersion bool
|
||||||
@@ -42,6 +45,8 @@ var (
|
|||||||
basicStatus, cpuTestStatus, memoryTestStatus, diskTestStatus bool
|
basicStatus, cpuTestStatus, memoryTestStatus, diskTestStatus bool
|
||||||
commTestStatus, utTestStatus, securityTestStatus, emailTestStatus bool
|
commTestStatus, utTestStatus, securityTestStatus, emailTestStatus bool
|
||||||
backtraceStatus, nt3Status, speedTestStatus bool
|
backtraceStatus, nt3Status, speedTestStatus bool
|
||||||
|
filePath = "goecs.txt"
|
||||||
|
enabelUpload = true
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
@@ -70,6 +75,8 @@ func main() {
|
|||||||
flag.IntVar(&spNum, "spnum", 2, "Set the number of servers per operator for speed test")
|
flag.IntVar(&spNum, "spnum", 2, "Set the number of servers per operator for speed test")
|
||||||
flag.BoolVar(&enableLogger, "log", false, "Enable/Disable logging in the current path")
|
flag.BoolVar(&enableLogger, "log", false, "Enable/Disable logging in the current path")
|
||||||
flag.Parse()
|
flag.Parse()
|
||||||
|
sig := make(chan os.Signal, 1)
|
||||||
|
signal.Notify(sig, os.Interrupt, syscall.SIGINT, syscall.SIGTERM)
|
||||||
if showVersion {
|
if showVersion {
|
||||||
fmt.Println(ecsVersion)
|
fmt.Println(ecsVersion)
|
||||||
return
|
return
|
||||||
@@ -216,6 +223,13 @@ func main() {
|
|||||||
basicInfo, securityInfo, emailInfo, mediaInfo string
|
basicInfo, securityInfo, emailInfo, mediaInfo string
|
||||||
output, tempOutput string
|
output, tempOutput string
|
||||||
)
|
)
|
||||||
|
// 启动一个goroutine来等待信号
|
||||||
|
go func() {
|
||||||
|
// 等待信号
|
||||||
|
<-sig
|
||||||
|
utils.ProcessAndUpload(output, filePath, enabelUpload)
|
||||||
|
os.Exit(1) // 使用非零状态码退出,表示意外退出
|
||||||
|
}()
|
||||||
output = utils.PrintAndCapture(func() {
|
output = utils.PrintAndCapture(func() {
|
||||||
switch language {
|
switch language {
|
||||||
case "zh":
|
case "zh":
|
||||||
@@ -372,6 +386,5 @@ func main() {
|
|||||||
fmt.Println("Unsupported language")
|
fmt.Println("Unsupported language")
|
||||||
}
|
}
|
||||||
}, tempOutput, output)
|
}, tempOutput, output)
|
||||||
filePath := "goecs.txt"
|
utils.ProcessAndUpload(output, filePath, enabelUpload)
|
||||||
utils.ProcessAndUpload(output, filePath, true)
|
|
||||||
}
|
}
|
||||||
|
25
goecs.sh
25
goecs.sh
@@ -61,7 +61,7 @@ goecs_check() {
|
|||||||
# 检测原始goecs命令是否存在,若存在则升级,不存在则安装
|
# 检测原始goecs命令是否存在,若存在则升级,不存在则安装
|
||||||
version_output=$(goecs -v || ./goecs -v)
|
version_output=$(goecs -v || ./goecs -v)
|
||||||
if [ $? -eq 0 ]; then
|
if [ $? -eq 0 ]; then
|
||||||
extracted_version=$(echo "$version_output" | grep -oP '^v\d+(\.\d+)+')
|
extracted_version=$(echo "${version_output//v/}")
|
||||||
if [ -n "$extracted_version" ]; then
|
if [ -n "$extracted_version" ]; then
|
||||||
current_version=$(echo "$extracted_version" | cut -c 2-)
|
current_version=$(echo "$extracted_version" | cut -c 2-)
|
||||||
ecs_version=$ECS_VERSION
|
ecs_version=$ECS_VERSION
|
||||||
@@ -293,14 +293,26 @@ env_check() {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
delete_goecs() {
|
||||||
|
rm -rf /root/goecs
|
||||||
|
rm -rf /usr/bin/goecs
|
||||||
|
}
|
||||||
|
|
||||||
show_help() {
|
show_help() {
|
||||||
cat <<"EOF"
|
cat <<"EOF"
|
||||||
Available commands:
|
Available commands:
|
||||||
|
|
||||||
env Check and Install package: dd fio sysbench geekbench5 speedtest
|
./goecs.sh env Check and Install package:
|
||||||
install Install goecs command
|
dd (Almost all unix-like systems have it, it's only for testing on most systems.)
|
||||||
upgrade Upgrade goecs command
|
fio (Almost all unix-like systems can be installed through the system's package manager.)
|
||||||
help Show this message
|
sysbench (Almost all unix-like systems can be installed through the system's package manager.)
|
||||||
|
geekbench5 (Only support IPV4 environment, and memory greater than 1GB network detection, only support amd64 and arm64 architecture.)
|
||||||
|
speedtest (Use the officially provided binaries for more accurate test results.)
|
||||||
|
In fact, sysbench/geekbench is the only one of the above dependencies that must be installed, without which the CPU score cannot be tested.
|
||||||
|
./goecs.sh install Install goecs command
|
||||||
|
./goecs.sh upgrade Upgrade goecs command
|
||||||
|
./goecs.sh delete Uninstall goecs command
|
||||||
|
./goecs.sh help Show this message
|
||||||
|
|
||||||
EOF
|
EOF
|
||||||
}
|
}
|
||||||
@@ -315,6 +327,9 @@ case "$1" in
|
|||||||
"install" | "upgrade")
|
"install" | "upgrade")
|
||||||
goecs_check
|
goecs_check
|
||||||
;;
|
;;
|
||||||
|
"delete")
|
||||||
|
delete_goecs
|
||||||
|
;;
|
||||||
*)
|
*)
|
||||||
echo "No command found."
|
echo "No command found."
|
||||||
echo
|
echo
|
||||||
|
1
发布版本.bat
1
发布版本.bat
@@ -24,6 +24,7 @@ REM 提示用户输入版本号
|
|||||||
set /p version="Enter the version number (e.g., v1.0.0): "
|
set /p version="Enter the version number (e.g., v1.0.0): "
|
||||||
|
|
||||||
REM 创建并推送标签
|
REM 创建并推送标签
|
||||||
|
:push_tag
|
||||||
git tag %version%
|
git tag %version%
|
||||||
git push origin %version%
|
git push origin %version%
|
||||||
if errorlevel 1 (
|
if errorlevel 1 (
|
||||||
|
Reference in New Issue
Block a user