diff --git a/go-daemon/info.go b/go-daemon/info.go index fc726b0..6e85c36 100644 --- a/go-daemon/info.go +++ b/go-daemon/info.go @@ -1,6 +1,7 @@ package main import ( + "fmt" "log" "os" "runtime" @@ -21,16 +22,7 @@ func checkExists(path string) (bool, error) { } func Info() { - // A SAMPLE COMMAND FOR LOGGING OS INFORMATION TO A DEDICATED FILE - userhome, err := os.UserHomeDir() // TODO $HOME is not defined while running as daemon !!! - if err != nil { - log.Fatal(err) - } - - // userhome := "/home/asandikci" // TEMPORARY - configDir := userhome + "/.config/" + ProgramName + "/" - // TODO Will be replaced with a Go Config Library - log.Print(configDir) + configDir := "/etc/godaemon1/" if flag, err := checkExists(configDir); flag { if err != nil { log.Fatal(err) @@ -44,6 +36,10 @@ func Info() { }{ {"OS", runtime.GOOS}, {"Time", time.Now().Format("2006.01.02 15:04:05")}, + {"Go Root", runtime.GOROOT()}, + {"Go Version", runtime.Version()}, + {"Go Arch", runtime.GOARCH}, + {"CPU Num", fmt.Sprintf("%v", runtime.NumCPU())}, } f, err := os.Create(configDir + "godaemon1.conf") diff --git a/go-daemon/install.sh b/go-daemon/install.sh index 7167ea1..2b38007 100644 --- a/go-daemon/install.sh +++ b/go-daemon/install.sh @@ -23,7 +23,7 @@ sudo touch /etc/godaemon1/userdata.conf sudo cat << EOF | sudo tee -a /etc/godaemon1/userdata.conf > /dev/null The current working directory is: $PWD You are logged in as $(whoami) -$HOME | $USER | $SUDO_USER +$HOME $USER $SUDO_USER EOF sudo chown root:root /etc/godaemon1/userdata.conf sudo chmod 640 /etc/godaemon1/userdata.conf