2016-11-29 17:06:23 -08:00
|
|
|
package control
|
|
|
|
|
|
|
|
import (
|
|
|
|
"os"
|
|
|
|
"os/exec"
|
|
|
|
"syscall"
|
|
|
|
|
2020-11-14 19:21:38 +02:00
|
|
|
"github.com/burmilla/os/pkg/log"
|
2018-10-23 12:13:32 +08:00
|
|
|
|
|
|
|
"github.com/codegangsta/cli"
|
2016-11-29 17:06:23 -08:00
|
|
|
)
|
|
|
|
|
|
|
|
func recoveryInitAction(c *cli.Context) error {
|
2017-07-16 11:50:01 +10:00
|
|
|
if err := writeRespawn("root", false, true); err != nil {
|
2016-11-29 17:06:23 -08:00
|
|
|
log.Error(err)
|
|
|
|
}
|
|
|
|
|
|
|
|
respawnBinPath, err := exec.LookPath("respawn")
|
|
|
|
if err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
|
|
|
|
return syscall.Exec(respawnBinPath, []string{"respawn", "-f", "/etc/respawn.conf"}, os.Environ())
|
|
|
|
}
|