Modernizing and adding irc secure option
[cytubebot.git] / index.js
blob345b4fdbffce9df81159ee57d9286d36e6292603
1 var forever = require("forever-monitor")
2 var fs = require("fs")
4 var child = new(forever.Monitor)("./lib/start.js", {
5     max: 21,
6     silent: false,
7     minUptime: 5000,
8     errFile: "./err.log"
9 })
11 var writeTimes = function() {
12     fs.writeFile("times", String(child.times), function(err) {
13         if (err) {
14             console.log(err)
15             child.stop()
16             process.exit(1)
17         }
18     })
21 child.on("exit", function() {
22     console.log("$~~~$ CytubeBot has exited after 20 restarts or there was a problem\n")
23     console.log("$~~~$ Shutting down")
27 child.on("restart", function() {
28     console.log("$~~~$ CytubeBot is restarting after a close\n")
29     writeTimes()
32 child.start()
33 writeTimes()