Convert from crond to supercronic

This commit is contained in:
Adam Outler
2025-11-22 01:29:50 +00:00
parent f0abd500d9
commit e3458630ba
13 changed files with 46 additions and 33 deletions

View File

@@ -1,4 +1,4 @@
# Every minute check for cron jobs
* * * * * /services/scripts/cron_script.sh
# Update vendors 4x/d
0 */6 * * * /services/scripts/update_vendors.sh
0 */6 * * * /services/scripts/update_vendors.sh

View File

@@ -7,10 +7,10 @@ export INSTALL_DIR=/app
if grep -q "cron_restart_backend" "${LOG_EXECUTION_QUEUE}"; then
killall python3
sleep 2
/services/start-backend.sh &
/services/start-backend.sh >/dev/null 2>&1 &
# Remove all lines containing cron_restart_backend from the log file
# Atomic replacement with temp file
grep -v "cron_restart_backend" "${LOG_EXECUTION_QUEUE}" > "${LOG_EXECUTION_QUEUE}.tmp" && \
mv "${LOG_EXECUTION_QUEUE}.tmp" "${LOG_EXECUTION_QUEUE}"
grep -v "cron_restart_backend" "${LOG_EXECUTION_QUEUE}" > "${LOG_EXECUTION_QUEUE}.tmp"
mv "${LOG_EXECUTION_QUEUE}.tmp" "${LOG_EXECUTION_QUEUE}"
fi

View File

@@ -6,7 +6,7 @@ crond_pid=""
cleanup() {
status=$?
echo "Crond stopped! (exit ${status})"
echo "Supercronic stopped! (exit ${status})"
}
forward_signal() {
@@ -23,11 +23,16 @@ done
trap cleanup EXIT
trap forward_signal INT TERM
echo "Starting /usr/sbin/crond -c \"${SYSTEM_SERVICES_CROND}\" -f -L \"${LOG_CROND}\" >>\"${LOG_CROND}\" 2>&1 &"
CRON_OPTS="--quiet"
if [ "${NETALERTX_DEBUG:-0}" -eq 1 ]; then
CRON_OPTS="--debug"
fi
/usr/sbin/crond -c "${SYSTEM_SERVICES_CROND}" -f -L "${LOG_CROND}" >>"${LOG_CROND}" 2>&1 &
echo "Starting supercronic ${CRON_OPTS} \"${SYSTEM_SERVICES_CONFIG_CRON}/crontab\" >>\"${LOG_CRON}\" 2>&1 &"
supercronic ${CRON_OPTS} "${SYSTEM_SERVICES_CONFIG_CRON}/crontab" >>"${LOG_CRON}" 2>&1 &
crond_pid=$!
wait "${crond_pid}"; status=$?
echo -ne " done"
exit ${status}
exit ${status}