Add LOGFILE configuration

This commit is contained in:
Sameer Rahmani 2022-04-19 15:03:29 +01:00
parent 74f82154c4
commit 5eebcb6815
2 changed files with 6 additions and 3 deletions

View File

@ -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.

View File

@ -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)