recovery_init.go 434 B

12345678910111213141516171819202122232425
  1. package control
  2. import (
  3. "os"
  4. "os/exec"
  5. "syscall"
  6. "github.com/rancher/os/pkg/log"
  7. "github.com/codegangsta/cli"
  8. )
  9. func recoveryInitAction(c *cli.Context) error {
  10. if err := writeRespawn("root", false, true); err != nil {
  11. log.Error(err)
  12. }
  13. respawnBinPath, err := exec.LookPath("respawn")
  14. if err != nil {
  15. return err
  16. }
  17. return syscall.Exec(respawnBinPath, []string{"respawn", "-f", "/etc/respawn.conf"}, os.Environ())
  18. }