Add LOGFILE configuration
This commit is contained in:
parent
74f82154c4
commit
5eebcb6815
|
@ -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
|
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
|
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.
|
integer that contains the length of the string that comes after it. That's it.
|
||||||
|
|
|
@ -36,6 +36,9 @@ if __name__ == "__main__":
|
||||||
config = dotenv.dotenv_values(sys.argv[1])
|
config = dotenv.dotenv_values(sys.argv[1])
|
||||||
action = sys.argv[2]
|
action = sys.argv[2]
|
||||||
pfile = config.get("PID_FILE", "/var/run/rigel.pid")
|
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)
|
pidlock = pidfile.PIDFile(pfile)
|
||||||
|
|
||||||
if action == "status":
|
if action == "status":
|
||||||
|
@ -50,8 +53,8 @@ if __name__ == "__main__":
|
||||||
print("Not running.")
|
print("Not running.")
|
||||||
elif action == "start":
|
elif action == "start":
|
||||||
|
|
||||||
with daemon.DaemonContext(stdout=sys.stdout,
|
with daemon.DaemonContext(stdout=logfile,
|
||||||
stderr=sys.stderr,
|
stderr=logfile,
|
||||||
pidfile=pidlock):
|
pidfile=pidlock):
|
||||||
|
|
||||||
main(config)
|
main(config)
|
||||||
|
|
Loading…
Reference in New Issue