25 lines
428 B
Go
25 lines
428 B
Go
|
package reach
|
||
|
|
||
|
import (
|
||
|
"github.com/pkg/errors"
|
||
|
)
|
||
|
|
||
|
const (
|
||
|
eventReboot = "reboot now"
|
||
|
)
|
||
|
|
||
|
// RebootNow asks the ReachRS module to reboot now
|
||
|
func (u *Updater) RebootNow() error {
|
||
|
|
||
|
var err error
|
||
|
|
||
|
u.logf("sending '%s' event", eventReboot)
|
||
|
if err = u.conn.Emit(eventReboot, nil); err != nil {
|
||
|
return errors.Wrapf(err, "error while emitting '%s' event", eventReboot)
|
||
|
}
|
||
|
u.logf("'%s' event sent", eventReboot)
|
||
|
|
||
|
return err
|
||
|
|
||
|
}
|