Commit 7794157e authored by Markus Seidl's avatar Markus Seidl

Added reboot command.

parent 581b958c
......@@ -49,10 +49,30 @@ func CCTelegramLoop(handler func(message Message) (timestamp time.Time, err erro
registerPasswordCommand(b)
registerDiskFreeCommand(b)
registerUpgradeCommand(b)
registerRebootCommand(b)
b.Start()
}
func registerRebootCommand(b *tb.Bot) {
b.Handle("/reboot", func(m *tb.Message) {
if !isAllowed(b, m) {
return
}
app := "./scripts/reboot.sh"
cmd := &exec.Cmd{
Path: app,
Args: []string{},
}
log.Printf("Executing: %s", app)
temp, err := cmd.CombinedOutput()
log.Print(err)
log.Print(string(temp))
})
}
func registerUpgradeCommand(b *tb.Bot) {
b.Handle("/upgrade", func(m *tb.Message) {
if !isAllowed(b, m) {
......
#!/bin/bash
sudo reboot
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment