Skip to content

Commit 14bf714

Browse files
committed
add additional warn if service file updated
1 parent f1e1b91 commit 14bf714

File tree

2 files changed

+12
-20
lines changed

2 files changed

+12
-20
lines changed

cmd/check_service_file.go

Lines changed: 11 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -35,24 +35,6 @@ func checkServiceFileForValidatorOnLinux(home string, serviceFilePath string) {
3535
}
3636

3737
// check service file content
38-
type unitServiceFile struct {
39-
Description string `toml:"Description"`
40-
After string `toml:"After"`
41-
}
42-
type serviceServiceFile struct {
43-
User string `toml:"User"`
44-
ExecStart string `toml:"ExecStart"`
45-
Restart string `toml:"Restart"`
46-
RestartSec string `toml:"RestartSec"`
47-
}
48-
type installServiceFile struct {
49-
WantedBy string `toml:"WantedBy"`
50-
}
51-
type serviceFile struct {
52-
Unit *unitServiceFile `toml:"Unit"`
53-
Service *serviceServiceFile `toml:"Service"`
54-
Install *installServiceFile `toml:"Install"`
55-
}
5638

5739
bz, err := os.ReadFile(serviceFilePath)
5840
if err != nil {
@@ -67,6 +49,13 @@ func checkServiceFileForValidatorOnLinux(home string, serviceFilePath string) {
6749
return
6850
}
6951

52+
originalRecordsCount := len(checkRecords)
53+
defer func() {
54+
if len(checkRecords) > originalRecordsCount {
55+
warnRecord("remember to reload service after updated service file", "sudo systemctl daemon-reload")
56+
}
57+
}()
58+
7059
if sf.Unit.Description.String() == "" {
7160
fatalRecord("service file is missing Description in [Unit] section", "add Description to [Unit] section")
7261
}
@@ -148,6 +137,9 @@ func checkServiceFileForValidatorOnLinux(home string, serviceFilePath string) {
148137
return
149138
}
150139
if exists {
151-
fatalRecord("service file is already enabled", "sudo systemctl disable "+serviceFileName)
140+
fatalRecord(
141+
"service file is already enabled, validator must disable service automatically run at startup",
142+
"sudo systemctl disable "+serviceFileName,
143+
)
152144
}
153145
}

constants/varcons.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ package constants
44

55
//goland:noinspection GoSnakeCaseUsage
66
var (
7-
VERSION = "1.1.0"
7+
VERSION = "1.1.1"
88
COMMIT_HASH = ""
99
BUILD_DATE = ""
1010
)

0 commit comments

Comments
 (0)