1
0
Fork 0

Use a PID file (to be used in a systemd unit)

This commit is contained in:
Luca Beltrame 2015-05-18 07:46:58 +02:00
parent a3687be334
commit bcdae9caaf

View file

@ -7,6 +7,7 @@ import tempfile
import git
from flask import Flask, request
from pid import PidFile
import sarge
from systemd.journal import JournalHandler
@ -20,9 +21,6 @@ def push_hook_to_server():
app.logger.info("New data received. Processing...")
handler = JournalHandler()
app.logger.addHandler(handler)
data = json.loads(request.data)
repository = data["repository"]
@ -43,4 +41,7 @@ def push_hook_to_server():
return "OK"
if __name__ == "__main__":
app.run()
with PidFile("/run/webhook/jekyll_webhook.pid", chmod=0o600):
handler = JournalHandler()
app.logger.addHandler(handler)
app.run()