Use a PID file (to be used in a systemd unit)
This commit is contained in:
parent
a3687be334
commit
bcdae9caaf
1 changed files with 5 additions and 4 deletions
|
@ -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()
|
||||
|
|
Loading…
Add table
Reference in a new issue