1
0
mirror of https://github.com/rancher/os.git synced 2025-09-01 14:48:55 +00:00

Cleanup logging

This commit is contained in:
Darren Shepherd
2015-02-21 00:34:23 -07:00
parent d63c875d13
commit dc59b3c724
2 changed files with 26 additions and 10 deletions

View File

@@ -25,6 +25,9 @@ var (
"/sbin",
"/usr/bin",
}
postDirs []string = []string{
"/var/log",
}
mounts [][]string = [][]string{
[]string{"devtmpfs", "/dev", "devtmpfs", ""},
[]string{"none", "/dev/pts", "devpts", ""},
@@ -99,6 +102,7 @@ func createMounts(mounts ...[]string) error {
}
func remountRo(cfg *config.Config) error {
log.Info("Remouting root read only")
return util.Remount("/", "ro")
}
@@ -198,10 +202,18 @@ func sysInit(cfg *config.Config) error {
}
func execDocker(cfg *config.Config) error {
log.Info("Launching Docker")
//os.Stdin.Close()
//os.Stdout.Close()
//os.Stderr.Close()
log.Info("Launching System Docker")
if !cfg.Debug {
output, err := os.Create("/var/log/system-docker.log")
if err != nil {
return err
}
syscall.Dup2(int(output.Fd()), int(os.Stdout.Fd()))
syscall.Dup2(int(output.Fd()), int(os.Stderr.Fd()))
}
os.Stdin.Close()
return syscall.Exec(DOCKER, cfg.SystemDockerArgs, os.Environ())
}
@@ -216,7 +228,7 @@ func mountState(cfg *config.Config) error {
if cfg.State.Dev != "" {
dev := util.ResolveDevice(cfg.State.Dev)
log.Debugf("Mounting state device %s to %s", dev, STATE)
log.Infof("Mounting state device %s to %s", dev, STATE)
fsType := cfg.State.FsType
if fsType == "auto" {
@@ -252,6 +264,7 @@ func RunInit() error {
return createDirs(dirs...)
},
func(cfg *config.Config) error {
log.Info("Setting up mounts")
return createMounts(mounts...)
},
func(cfg *config.Config) error {
@@ -276,6 +289,9 @@ func RunInit() error {
extractModules,
loadModules,
mountState,
func(cfg *config.Config) error {
return createDirs(postDirs...)
},
func(cfg *config.Config) error {
return createMounts(postMounts...)
},