@@ -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}
0 commit comments