From 15dbc4307f9ab5985deec167961e35a8d4b15039 Mon Sep 17 00:00:00 2001 From: Franziska Kunsmann Date: Wed, 19 Aug 2020 21:51:03 +0200 Subject: [PATCH] bundles/travelynx: use worker service instead of cronjob --- bundles/travelynx/files/travelynx-worker.service | 15 +++++++++++++++ bundles/travelynx/items.py | 11 +++++++++++ bundles/travelynx/metadata.py | 3 --- 3 files changed, 26 insertions(+), 3 deletions(-) create mode 100644 bundles/travelynx/files/travelynx-worker.service diff --git a/bundles/travelynx/files/travelynx-worker.service b/bundles/travelynx/files/travelynx-worker.service new file mode 100644 index 0000000..72215fd --- /dev/null +++ b/bundles/travelynx/files/travelynx-worker.service @@ -0,0 +1,15 @@ +[Unit] +Description=Travelynx Railway Checkin Service - Worker +After=network.target + +[Service] +ExecStart=/usr/bin/perl index.pl worker + +User=travelynx +WorkingDirectory=/opt/travelynx + +Environment=LANG=en_US.UTF-8 +Environment=PERL5LIB=/opt/travelynx/local/lib/perl5 + +[Install] +WantedBy=multi-user.target diff --git a/bundles/travelynx/items.py b/bundles/travelynx/items.py index 494d854..349b948 100644 --- a/bundles/travelynx/items.py +++ b/bundles/travelynx/items.py @@ -16,6 +16,11 @@ files = { 'action:systemd-reload', }, }, + '/etc/systemd/system/travelynx-worker.service': { + 'triggers': { + 'action:systemd-reload', + }, + }, '/opt/travelynx/travelynx.conf': { 'content_type': 'mako', 'context': node.metadata['travelynx'], @@ -73,4 +78,10 @@ svc_systemd = { 'directory:/var/cache/travelynx', }, }, + 'travelynx-worker': { + 'needs': { + 'file:/etc/systemd/system/travelynx-worker.service', + 'svc_systemd:travelynx', + }, + }, } diff --git a/bundles/travelynx/metadata.py b/bundles/travelynx/metadata.py index 1266e85..d413405 100644 --- a/bundles/travelynx/metadata.py +++ b/bundles/travelynx/metadata.py @@ -5,9 +5,6 @@ defaults = { 'deploy_configs': False, }, }, - 'cron': { - 'travelynx': '*/3 * * * * travelynx cd /opt/travelynx && timeout 5m perl index.pl work -m production', - }, 'travelynx': { 'database': { 'username': 'travelynx',