From 49ba964897da59f4208a566dfa1a41c9fe417a93 Mon Sep 17 00:00:00 2001 From: Johan Wassberg Date: Thu, 2 Feb 2023 11:45:30 +0100 Subject: [PATCH] Wrap cosmos in scriptherder if available nunoc-ops and others has been doing this for ages by just modifing the cron file. --- global/overlay/etc/cron.d/cosmos | 2 +- global/overlay/usr/local/libexec/cosmos-cron-wrapper | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) create mode 100644 global/overlay/usr/local/libexec/cosmos-cron-wrapper diff --git a/global/overlay/etc/cron.d/cosmos b/global/overlay/etc/cron.d/cosmos index 4eab8de..38d14f5 100644 --- a/global/overlay/etc/cron.d/cosmos +++ b/global/overlay/etc/cron.d/cosmos @@ -1,4 +1,4 @@ SHELL=/bin/sh PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin -*/15 * * * * root test -f /etc/no-automatic-cosmos || /usr/local/bin/run-cosmos +*/15 * * * * root test -f /etc/no-automatic-cosmos || /usr/local/libexec/cosmos-cron-wrapper diff --git a/global/overlay/usr/local/libexec/cosmos-cron-wrapper b/global/overlay/usr/local/libexec/cosmos-cron-wrapper new file mode 100644 index 0000000..2df85b5 --- /dev/null +++ b/global/overlay/usr/local/libexec/cosmos-cron-wrapper @@ -0,0 +1,10 @@ +#!/usr/bin/env bash + +RUN_COSMOS=/usr/local/bin/run-cosmos +SCRIPTHERDER_CMD='' + +if [ -f /usr/local/bin/scriptherder ]; then + SCRIPTHERDER_CMD='/usr/local/bin/scriptherder --mode wrap --syslog --name cosmos --' +fi + +${SCRIPTHERDER_CMD} ${RUN_COSMOS}