Remove unused commented code
This commit is contained in:
@@ -23,22 +23,10 @@ import (
|
|||||||
"syscall"
|
"syscall"
|
||||||
)
|
)
|
||||||
|
|
||||||
//const mainDir string := "/mnt/mqm"
|
|
||||||
const mqmUID uint32 = 999
|
const mqmUID uint32 = 999
|
||||||
const mqmGID uint32 = 999
|
const mqmGID uint32 = 999
|
||||||
|
|
||||||
func createVolume(path string) error {
|
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")
|
dataPath := filepath.Join(path, "data")
|
||||||
fi, err := os.Stat(dataPath)
|
fi, err := os.Stat(dataPath)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -57,8 +45,6 @@ func createVolume(path string) error {
|
|||||||
}
|
}
|
||||||
sys := fi.Sys()
|
sys := fi.Sys()
|
||||||
if sys != nil && runtime.GOOS == "linux" {
|
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)
|
stat := sys.(*syscall.Stat_t)
|
||||||
if stat.Uid != mqmUID || stat.Gid != mqmGID {
|
if stat.Uid != mqmUID || stat.Gid != mqmGID {
|
||||||
err = os.Chown(dataPath, int(mqmUID), int(mqmGID))
|
err = os.Chown(dataPath, int(mqmUID), int(mqmGID))
|
||||||
@@ -70,18 +56,3 @@ func createVolume(path string) error {
|
|||||||
}
|
}
|
||||||
return nil
|
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
|
|
||||||
|
|||||||
@@ -125,7 +125,6 @@ func getQueueManagerName() (string, error) {
|
|||||||
// runCommand runs an OS command. On Linux it waits for the command to
|
// runCommand runs an OS command. On Linux it waits for the command to
|
||||||
// complete and returns the exit status (return code).
|
// complete and returns the exit status (return code).
|
||||||
func runCommand(name string, arg ...string) (string, int, error) {
|
func runCommand(name string, arg ...string) (string, int, error) {
|
||||||
// log.Debugf("Running command %v %v", name, arg)
|
|
||||||
cmd := exec.Command(name, arg...)
|
cmd := exec.Command(name, arg...)
|
||||||
// Run the command and wait for completion
|
// Run the command and wait for completion
|
||||||
out, err := cmd.CombinedOutput()
|
out, err := cmd.CombinedOutput()
|
||||||
@@ -133,12 +132,8 @@ func runCommand(name string, arg ...string) (string, int, error) {
|
|||||||
var rc int
|
var rc int
|
||||||
// Only works on Linux
|
// Only works on Linux
|
||||||
if runtime.GOOS == "linux" {
|
if runtime.GOOS == "linux" {
|
||||||
// func Wait4(pid int, wstatus *WaitStatus, options int, rusage *Rusage) (wpid int, err error)
|
|
||||||
var ws unix.WaitStatus
|
var ws unix.WaitStatus
|
||||||
//var rusage syscall.Rusage
|
|
||||||
unix.Wait4(cmd.Process.Pid, &ws, 0, nil)
|
unix.Wait4(cmd.Process.Pid, &ws, 0, nil)
|
||||||
//ee := err.(*os.SyscallError)
|
|
||||||
//ws := ee.Sys().(syscall.WaitStatus)
|
|
||||||
rc = ws.ExitStatus()
|
rc = ws.ExitStatus()
|
||||||
} else {
|
} else {
|
||||||
rc = -1
|
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() {
|
func main() {
|
||||||
createReaper()
|
createReaper()
|
||||||
checkLicense()
|
checkLicense()
|
||||||
|
|
||||||
// Start SIGTERM handler channel
|
// Start SIGTERM handler channel
|
||||||
done := createTerminateChannel()
|
done := createTerminateChannel()
|
||||||
|
|
||||||
@@ -316,13 +280,13 @@ func main() {
|
|||||||
log.Fatalln(err)
|
log.Fatalln(err)
|
||||||
}
|
}
|
||||||
log.Printf("Using queue manager name: %v", name)
|
log.Printf("Using queue manager name: %v", name)
|
||||||
|
|
||||||
logConfig()
|
logConfig()
|
||||||
err = createVolume("/mnt/mqm")
|
err = createVolume("/mnt/mqm")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
createDirStructure()
|
createDirStructure()
|
||||||
//mirrorLog("/var/mqm/qmgrs/" + name + "/errors/AMQERR01.LOG")
|
|
||||||
createQueueManager(name)
|
createQueueManager(name)
|
||||||
updateCommandLevel()
|
updateCommandLevel()
|
||||||
startQueueManager()
|
startQueueManager()
|
||||||
|
|||||||
Reference in New Issue
Block a user