diff --git a/cmd/runmqserver/crtmqvol.go b/cmd/runmqserver/crtmqvol.go index c7eca4c..9997eba 100644 --- a/cmd/runmqserver/crtmqvol.go +++ b/cmd/runmqserver/crtmqvol.go @@ -23,22 +23,10 @@ import ( "syscall" ) -//const mainDir string := "/mnt/mqm" const mqmUID uint32 = 999 const mqmGID uint32 = 999 func createVolume(path string) error { - // fi, err := os.Stat(path) - // if err != nil { - // if os.IsNotExist(err) { - // // TODO: Should this be fatal? - // //log.Warnf("No volume found under %v", path) - // return nil - // } else { - // return err - // } - // } - //log.Printf("%v details: %v", path, fi.Sys()) dataPath := filepath.Join(path, "data") fi, err := os.Stat(dataPath) if err != nil { @@ -57,8 +45,6 @@ func createVolume(path string) error { } sys := fi.Sys() if sys != nil && runtime.GOOS == "linux" { - // log.Printf("Checking UID/GID for %v", dataPath) - //log.Debugf("Checking UID/GID for %v", dataPath) stat := sys.(*syscall.Stat_t) if stat.Uid != mqmUID || stat.Gid != mqmGID { err = os.Chown(dataPath, int(mqmUID), int(mqmGID)) @@ -70,18 +56,3 @@ func createVolume(path string) error { } return nil } - -// If /mnt/mqm exists -// If /mnt/mqm contains a "data" directory AND data is owned by mqm:mqm AND data is writeable by mqm:mqm then -// Create Symlink from /var/mqm to /mnt/mqm/data -// Else -// // Try to sort it out -// Create directory /mnt/mqm/data -// If directory not already owned by mqm:mqm -// chown mqm:mqm -// if error -// delete directory again if empty -// if directory not already 0755 -// chmod 0755 -// if error -// delete directory again if empty diff --git a/cmd/runmqserver/main.go b/cmd/runmqserver/main.go index c0a8fce..06e0714 100644 --- a/cmd/runmqserver/main.go +++ b/cmd/runmqserver/main.go @@ -125,7 +125,6 @@ func getQueueManagerName() (string, error) { // runCommand runs an OS command. On Linux it waits for the command to // complete and returns the exit status (return code). func runCommand(name string, arg ...string) (string, int, error) { - // log.Debugf("Running command %v %v", name, arg) cmd := exec.Command(name, arg...) // Run the command and wait for completion out, err := cmd.CombinedOutput() @@ -133,12 +132,8 @@ func runCommand(name string, arg ...string) (string, int, error) { var rc int // Only works on Linux if runtime.GOOS == "linux" { - // func Wait4(pid int, wstatus *WaitStatus, options int, rusage *Rusage) (wpid int, err error) var ws unix.WaitStatus - //var rusage syscall.Rusage unix.Wait4(cmd.Process.Pid, &ws, 0, nil) - //ee := err.(*os.SyscallError) - //ws := ee.Sys().(syscall.WaitStatus) rc = ws.ExitStatus() } else { rc = -1 @@ -274,40 +269,9 @@ func createReaper() { }() } -// mirrorLog tails the specified file, and logs each line. -// This is useful for usability, as the container console log can show -// messages from the MQ log. -// func mirrorLog(path string) error { -// tail, err := tail.TailFile(path, tail.Config{ -// ReOpen: true, -// Follow: true, -// Poll: true, -// Location: &tail.SeekInfo{ -// Offset: 0, -// // End of file -// Whence: 2, -// }, -// Logger: tail.DiscardingLogger, -// }) -// if err != nil { -// return err -// } -// go func() { -// for line := range tail.Lines { -// // TODO: Unless we parse the message, the timestamp will be (slightly) wrong -// if strings.HasPrefix(line.Text, "AMQ") { -// // TODO: Extended characters don't print correctly -// log.Println(line.Text) -// } -// } -// }() -// return nil -// } - func main() { createReaper() checkLicense() - // Start SIGTERM handler channel done := createTerminateChannel() @@ -316,13 +280,13 @@ func main() { log.Fatalln(err) } log.Printf("Using queue manager name: %v", name) + logConfig() err = createVolume("/mnt/mqm") if err != nil { log.Fatal(err) } createDirStructure() - //mirrorLog("/var/mqm/qmgrs/" + name + "/errors/AMQERR01.LOG") createQueueManager(name) updateCommandLevel() startQueueManager()