Browse Source

go fmt

master
Gregory Rudolph 2 years ago
parent
commit
1598980f0e
Signed by: rudi
GPG Key ID: EF64F3CBD1A1EBDD
  1. 15
      main.go
  2. 24
      strings.go

15
main.go

@ -3,7 +3,7 @@ package main
import ( import (
"bufio" "bufio"
"flag" "flag"
"fmt" "fmt"
"log" "log"
"os" "os"
"os/exec" "os/exec"
@ -12,12 +12,12 @@ import (
) )
var ( var (
startup []string startup []string
daemon = false daemon = false
serviceFile = "/adm/services" serviceFile = "/adm/services"
services = make(map[string]string) services = make(map[string]string)
controlSocket = "/adm/headless9/ctl/headless9.ctl" controlSocket = "/adm/headless9/ctl/headless9.ctl"
logPath = "/adm/headless9/log/" logPath = "/adm/headless9/log/"
) )
func main() { func main() {
@ -45,7 +45,7 @@ func main() {
log.Println(err) log.Println(err)
} }
fmt.Println(strings.Join(sysTail(10, controlSocket), "\n")) fmt.Println(strings.Join(sysTail(10, controlSocket), "\n"))
} }
func getCtl() *os.File { func getCtl() *os.File {
@ -119,12 +119,9 @@ func headlessControls() {
log.Printf(DAEMON_PROCESSING_CTL, cmd) log.Printf(DAEMON_PROCESSING_CTL, cmd)
} }
} }
} }
} }
func execCommand(cmd string, arg ...string) { func execCommand(cmd string, arg ...string) {
defer PanicSafe() defer PanicSafe()
if len(cmd) < 2 { if len(cmd) < 2 {
@ -210,4 +207,4 @@ func sysTail(count int, path string) []string {
lines := strings.Split(string(output), "\n") lines := strings.Split(string(output), "\n")
return lines[:len(lines)-1] return lines[:len(lines)-1]
} }

24
strings.go

@ -1,16 +1,16 @@
package main package main
var ( var (
DAEMON_START = "Starting headless9" DAEMON_START = "Starting headless9"
CMD_SYNTAX = "Command structure: \"headless9 $verb $service\"" CMD_SYNTAX = "Command structure: \"headless9 $verb $service\""
CTL_UNABLE_WRITE = "Unable to write to Control Socket. Please check the file %+v and that it's permissions are 700" CTL_UNABLE_WRITE = "Unable to write to Control Socket. Please check the file %+v and that it's permissions are 700"
CTL_NOT_OPEN = "Unable to open Control Socket. Please check the file %+v and that it's permissions are 700" CTL_NOT_OPEN = "Unable to open Control Socket. Please check the file %+v and that it's permissions are 700"
CTL_NOT_CLEAR = "Unable to clear Control Socket. Please check the file %+v and that it's permissions are 700" CTL_NOT_CLEAR = "Unable to clear Control Socket. Please check the file %+v and that it's permissions are 700"
CTL_NOT_REWOUND = "Unable to rewind Control Socket. Please check the file %+v and that it's permissions are 700" CTL_NOT_REWOUND = "Unable to rewind Control Socket. Please check the file %+v and that it's permissions are 700"
DAEMON_FILE_REFRESH = "Refreshing controlFile %+v" DAEMON_FILE_REFRESH = "Refreshing controlFile %+v"
DAEMON_SVC_EXISTS = "%+v exists as PID %+v" DAEMON_SVC_EXISTS = "%+v exists as PID %+v"
DAEMON_SVC_MISSING = "Svc not detected, starting: %+v" DAEMON_SVC_MISSING = "Svc not detected, starting: %+v"
DAEMON_PROCESSING_CTL = "Processing command: %+v" DAEMON_PROCESSING_CTL = "Processing command: %+v"
DAEMON_CMD_INVALID = "Invalid command `%v`, skipping. Args: { %+v }" DAEMON_CMD_INVALID = "Invalid command `%v`, skipping. Args: { %+v }"
DAEMON_SVC_FAIL = "Error starting service %+v, see log for more info." DAEMON_SVC_FAIL = "Error starting service %+v, see log for more info."
) )

Loading…
Cancel
Save