Compare commits

..

No commits in common. "852874a12aa586e7603c37d14e7c83823e941e54" and "ba71b423691166c4a65ee84fa80d5c54af904973" have entirely different histories.

2 changed files with 0 additions and 38 deletions

View File

@ -150,25 +150,6 @@ func initMatrix() {
return text + "\n🟢 Successfully restarted site."
})
registerChatCommand("stop", "Stop a site.", func(ctx context.Context, evt *event.Event, args []string) string {
if len(args) < 2 {
return "🔴 Invalid site."
}
site, found, err := getSite(args[1])
if err != nil {
return "🔴 Failed to get site " + args[2] + "!"
} else if !found {
return "🔴 Invalid site."
}
text := "⚪️ Stopping server..."
if derr := site.Stop(); derr.code != 0 {
derr.SendOverMatrix()
return text + "\n🔴 Failed to stop site!"
}
return text + "\n🟢 Successfully stopped site."
})
go func() {
for range time.Tick(time.Second * 6) {
log.Printf("Scanning for queued messages...")

19
site.go
View File

@ -134,25 +134,6 @@ func (site *Site) Start() DeployError {
return DeployError{}
}
// Stop attempts to stop a Lapis server in the given repository.
func (site *Site) Stop() DeployError {
log.Printf("Stopping Lapis server %s...", site.getName())
old_cwd, _ := os.Getwd()
defer syscall.Chdir(old_cwd)
syscall.Chdir(configuration.sites_dir + "/" + site.name)
cmd := exec.Command("lapis", "term")
if err := cmd.Start(); err != nil {
return newDeployError(1, "stopSite",
fmt.Sprintf("Failed to stop Lapis server in '%s'", site.getName()), "")
}
go func() {
cmd.Wait()
}()
return DeployError{}
}
// Restart attempts to restart the Lapis server in the given repository.
func (site *Site) Restart() DeployError {
log.Printf("Restarting Lapis server in %s...", site.getName())