#!/bin/bash . /usr/src/m2/framework/bash_functions.sh config="/etc/m2/system.conf" grep -Fq 'es_sync_control' $config || { echo ""; echo "es_sync_control = 1"; } >> $config grep -Fq 'es_sync_send_email' $config || echo "es_sync_send_email = 1" >> $config grep -Fq 'es_sync_check_period' $config || echo "es_sync_check_period = 31" >> $config grep -Fq 'es_sync_interfering_conflines_check' $config || echo "es_sync_interfering_conflines_check = 1" >> $config cd /usr/src/m2/elasticsearch cp -f es_sync_control.sh /usr/local/m2/ chmod +x /usr/local/m2/es_sync_control.sh cp -f es_sync_control_hourly.sh /usr/local/m2/ chmod +x /usr/local/m2/es_sync_control_hourly.sh echo "15 5 * * * root /usr/local/m2/es_sync_control.sh >> /var/log/m2/es_sync_control.log 2>&1" > /etc/cron.d/m2_es_sync_control chmod 0644 /etc/cron.d/m2_es_sync_control echo "40 * * * * root sleep 20 && /usr/local/m2/es_sync_control_hourly.sh >> /var/log/m2/es_sync_control_hourly.log 2>&1" > /etc/cron.d/m2_es_sync_control_hourly chmod 0644 /etc/cron.d/m2_es_sync_control_hourly service crond restart 2>/dev/null report "ES sync control scripts have been installed" 0