2024-10-12 10:59:11 -05:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
2024-10-13 02:23:30 -05:00
|
|
|
"time"
|
|
|
|
|
2024-10-13 01:33:32 -05:00
|
|
|
"go.wit.com/lib/gui/shell"
|
2024-10-12 10:59:11 -05:00
|
|
|
"go.wit.com/log"
|
|
|
|
)
|
|
|
|
|
|
|
|
func (d *DropletT) Start() {
|
|
|
|
log.Info("a new virtual machine is running")
|
|
|
|
}
|
2024-10-13 01:33:32 -05:00
|
|
|
|
|
|
|
func (h *HyperT) RestartDaemon() {
|
|
|
|
url := "http://" + h.Hostname + ":2520/kill"
|
|
|
|
s := shell.Wget(url)
|
|
|
|
log.Info("EVENT RestartDaemon", url, s)
|
2024-10-13 02:23:30 -05:00
|
|
|
h.lastpoll = time.Now()
|
|
|
|
h.killcount += 1
|
|
|
|
|
|
|
|
dur := time.Since(h.lastpoll) // Calculate the elapsed time
|
|
|
|
log.Info("KILLED DAEMON", h.Hostname, shell.FormatDuration(dur), "curl", url)
|
2024-10-13 03:20:48 -05:00
|
|
|
me.killcount += 1
|
2024-10-13 01:33:32 -05:00
|
|
|
}
|
2024-10-13 03:49:54 -05:00
|
|
|
|
|
|
|
func (h *HyperT) Start(d *DropletT) {
|
|
|
|
url := "http://" + h.Hostname + ":2520/start?" + d.Hostname
|
|
|
|
s := shell.Wget(url)
|
|
|
|
log.Info("EVENT start droplet", url, s)
|
|
|
|
}
|