diff --git a/rigel/README.md b/rigel/README.md index 18caed6..4681824 100644 --- a/rigel/README.md +++ b/rigel/README.md @@ -16,7 +16,7 @@ script like: ``` Rigel will listen to the tcp port provided by HOST and PORT vars in `.env`(at the root of -project) and converts any text messages that gets into speech on the fly. +project. Checkout `env.example`) and converts any text messages that gets into speech on the fly. The protocol is pretty simple. The packet should start with 32 bit unsigned integer that contains the length of the string that comes after it. That's it. diff --git a/rigel/server.py b/rigel/server.py index e342e7f..f739562 100755 --- a/rigel/server.py +++ b/rigel/server.py @@ -36,6 +36,9 @@ if __name__ == "__main__": config = dotenv.dotenv_values(sys.argv[1]) action = sys.argv[2] pfile = config.get("PID_FILE", "/var/run/rigel.pid") + logs = config.get("LOGFILE") + logfile = open(logs, 'a+') if logs else sys.stdout + pidlock = pidfile.PIDFile(pfile) if action == "status": @@ -50,8 +53,8 @@ if __name__ == "__main__": print("Not running.") elif action == "start": - with daemon.DaemonContext(stdout=sys.stdout, - stderr=sys.stderr, + with daemon.DaemonContext(stdout=logfile, + stderr=logfile, pidfile=pidlock): main(config)