1
0
mirror of https://git.sdf.org/rudi/headless9.git synced 2026-03-22 05:17:27 +00:00

Create control file if not exist

This commit is contained in:
2022-10-23 00:14:09 -04:00
parent 76689159fb
commit fc38252492

11
main.go
View File

@ -2,6 +2,7 @@ package main
import (
"bufio"
"errors"
"flag"
"fmt"
"log"
@ -81,7 +82,15 @@ func runDaemon() {
log.Printf(DAEMON_FILE_REFRESH, serviceFile)
startup, err := readLines(serviceFile)
if err != nil {
log.Fatalln(err)
if errors.Is(err, os.ErrNotExist) {
test, err := os.Create(serviceFile)
if err != nil {
log.Fatalln(err)
}
test.Close()
} else {
log.Fatalln(err)
}
}
for _, svc := range startup {
running := false