Initial Stuff

This commit is contained in:
Caleb Gardner
2021-09-18 02:30:32 -05:00
parent e34ef54b0a
commit 9318ccef18
5 changed files with 209 additions and 2 deletions
+39
View File
@@ -0,0 +1,39 @@
package main
import (
"log"
"time"
)
var quitChan chan string = make(chan string)
func main() {
go tcpLinker()
go webserver()
for failure := <-quitChan; ; failure = <-quitChan {
switch failure {
case "tcp conf":
continue
case "tcp err":
go tcpLinkerRestart()
case "web arg":
continue
case "web err":
go websiteRestart()
}
}
}
func tcpLinkerRestart() {
log.Println("TCP linker failed. Restarting in 5 seconds...")
time.Sleep(5 * time.Second)
log.Println("Restarting tcp linker")
tcpLinker()
}
func websiteRestart() {
log.Println("Website failed. Restarting in 5 seconds...")
time.Sleep(5 * time.Second)
log.Println("Restarting website")
webserver()
}