recovery_init.go 434 B

123456789101112131415161718192021222324
  1. package control
  2. import (
  3. "os"
  4. "os/exec"
  5. "syscall"
  6. log "github.com/Sirupsen/logrus"
  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. }