1
0
Fork 0
mirror of https://github.com/librenms/docker.git synced 2026-01-23 10:15:22 +00:00

Run maintenance task through a dedicated process (#105)

This commit is contained in:
CrazyMax 2020-08-28 08:58:41 +02:00
parent 1d2733b051
commit 5a37ac37df
No known key found for this signature in database
GPG key ID: 3248E46B6BB8C7F7
2 changed files with 16 additions and 5 deletions

View file

@ -179,6 +179,13 @@ if [ ! -z "${RRDCACHED_HOST}" ]; then
EOL
fi
# Config : Dispatcher
cat > ${LIBRENMS_PATH}/config.d/dispatcher.php <<EOL
<?php
\$config['service_update_enabled'] = false;
\$config['service_watchdog_enabled'] = false;
EOL
# Fix perms
echo "Fixing perms..."
chown librenms. /data/config /data/monitoring-plugins /data/rrd /data/weathermap

View file

@ -4,11 +4,12 @@ CRONTAB_PATH="/var/spool/cron/crontabs"
LIBRENMS_WEATHERMAP=${LIBRENMS_WEATHERMAP:-false}
LIBRENMS_WEATHERMAP_SCHEDULE=${LIBRENMS_WEATHERMAP_SCHEDULE:-*/5 * * * *}
LIBRENMS_DAILY_SCHEDULE="15 0 * * *"
SIDECAR_DISPATCHER=${SIDECAR_DISPATCHER:-0}
SIDECAR_SYSLOGNG=${SIDECAR_SYSLOGNG:-0}
if [ "$SIDECAR_DISPATCHER" = "1" ] || [ "$SIDECAR_SYSLOGNG" = "1" ] || [ "$LIBRENMS_WEATHERMAP" != "true" ]; then
if [ "$SIDECAR_DISPATCHER" = "1" ] || [ "$SIDECAR_SYSLOGNG" = "1" ]; then
exit 0
fi
@ -18,7 +19,10 @@ mkdir -m 0644 -p ${CRONTAB_PATH}
touch ${CRONTAB_PATH}/librenms
# Cron
if [ -n "$LIBRENMS_WEATHERMAP_SCHEDULE" ]; then
echo "Creating LibreNMS daily.sh cron task with the following period fields: $LIBRENMS_DAILY_SCHEDULE"
echo "${LIBRENMS_DAILY_SCHEDULE} cd /opt/librenms/ && bash daily.sh" >> ${CRONTAB_PATH}/librenms
if [ "$LIBRENMS_WEATHERMAP" = "true" ] && [ -n "$LIBRENMS_WEATHERMAP_SCHEDULE" ]; then
echo "Creating LibreNMS Weathermap cron task with the following period fields: $LIBRENMS_WEATHERMAP_SCHEDULE"
echo "${LIBRENMS_WEATHERMAP_SCHEDULE} php -f /opt/librenms/html/plugins/Weathermap/map-poller.php" >> ${CRONTAB_PATH}/librenms
fi
@ -28,10 +32,10 @@ echo "Fixing crontabs permissions..."
chmod -R 0644 ${CRONTAB_PATH}
# Create service
mkdir -p /etc/services.d/weathermap
cat > /etc/services.d/weathermap/run <<EOL
mkdir -p /etc/services.d/cron
cat > /etc/services.d/cron/run <<EOL
#!/usr/bin/execlineb -P
with-contenv
exec busybox crond -f -L /dev/stdout
EOL
chmod +x /etc/services.d/weathermap/run
chmod +x /etc/services.d/cron/run