BathHacked/energy-sparks

View on GitHub
.ebextensions/cronjob.config

Summary

Maintainability
Test Coverage
files:
    #
    # Check for DCC meters
    #
    "/etc/cron.d/dcc-check":
        mode: "000644"
        owner: root
        group: root
        content: |
            00 1 * * * root /bin/bash -l -c 'cd /var/app/current && RAILS_ENV=production bin/run_as_webapp bundle exec rake meters:check_for_dcc >> log/jobs.log 2>&1'

    #
    # Load non-amr data feeds
    #
    "/etc/cron.d/carbon-intensity":
        mode: "000644"
        owner: root
        group: root
        content: |
            00 3 * * * root /bin/bash -l -c 'cd /var/app/current && RAILS_ENV=production bin/run_as_webapp bundle exec rake data_feeds:carbon_intensity_loader >> log/jobs.log 2>&1'

    "/etc/cron.d/load-solar-pv-tuos":
        mode: "000644"
        owner: root
        group: root
        content: |
            30 3,15 * * * root /bin/bash -l -c 'cd /var/app/current && RAILS_ENV=production bin/run_as_webapp bundle exec rake data_feeds:solar_pv_tuos_loader >> log/jobs.log 2>&1'

    "/etc/cron.d/load-meteostat-data":
        mode: "000644"
        owner: root
        group: root
        content: |
            50 3 * * * root /bin/bash -l -c 'cd /var/app/current && RAILS_ENV=production bin/run_as_webapp bundle exec rake data_feeds:meteostat_loader >> log/jobs.log 2>&1'

    "/etc/cron.d/back-fill-any-meteostat-temperatures":
        mode: "000644"
        owner: root
        group: root
        content: |
            55 3 * * * root /bin/bash -l -c 'cd /var/app/current && RAILS_ENV=production bin/run_as_webapp bundle exec rake data_feeds:meteostat_back_fill >> log/jobs.log 2>&1'

    "/etc/cron.d/back-fill-any-solar-pv-readings":
        mode: "000644"
        owner: root
        group: root
        content: |
            35 3 * * * root /bin/bash -l -c 'cd /var/app/current && RAILS_ENV=production bin/run_as_webapp bundle exec rake data_feeds:solar_pv_tuos_back_fill >> log/jobs.log 2>&1'

    #
    # Import CSV files
    #
    "/etc/cron.d/import-csv-files":
        mode: "000644"
        owner: root
        group: root
        content: |
            15 5 * * * root /bin/bash -l -c 'cd /var/app/current && RAILS_ENV=production bin/run_as_webapp bundle exec rake amr:import_all >> log/jobs.log 2>&1'

    "/etc/cron.d/import-rtone-variant-data":
        mode: "000644"
        owner: root
        group: root
        content: |
            20 4 * * * root /bin/bash -l -c 'cd /var/app/current && RAILS_ENV=production bin/run_as_webapp bundle exec rake solar:import_rtone_variant_readings >> log/jobs.log 2>&1'

    #
    # Import Solar Edge data
    #
    "/etc/cron.d/import-solar-edge-data":
        mode: "000644"
        owner: root
        group: root
        content: |
            15 4 * * * root /bin/bash -l -c 'cd /var/app/current && RAILS_ENV=production bin/run_as_webapp bundle exec rake solar:import_solar_edge_readings >> log/jobs.log 2>&1'

    #
    # Import Low carbon hub data
    #
    "/etc/cron.d/import-low-carbon-hub-data":
        mode: "000644"
        owner: root
        group: root
        content: |
            05 5 * * * root /bin/bash -l -c 'cd /var/app/current && RAILS_ENV=production bin/run_as_webapp bundle exec rake solar:import_low_carbon_hub_readings >> log/jobs.log 2>&1'

    #
    # Import n3rgy readings
    #
    "/etc/cron.d/import-n3rgy-readings":
      mode: "000644"
      owner: root
      group: root
      content: |
        0 14 * * * root /bin/bash -l -c 'cd /var/app/current && RAILS_ENV=production bin/run_as_webapp bundle exec rake amr:import_n3rgy_readings >> log/jobs.log 2>&1'

    "/etc/cron.d/import_n3rgy_tariffs":
      mode: "000644"
      owner: root
      group: root
      content: |
        10 14 * * * root /bin/bash -l -c 'cd /var/app/current && RAILS_ENV=production bin/run_as_webapp bundle exec rake amr:import_n3rgy_tariffs >> log/jobs.log 2>&1'

    #
    # Start daily regeneration jobs
    #
    "/etc/cron.d/daily-regeneration":
        mode: "000644"
        owner: root
        group: root
        content: |
            00 6 * * * root /bin/bash -l -c 'cd /var/app/current && RAILS_ENV=production bin/run_as_webapp bundle exec rake school:daily_regeneration >> log/jobs.log 2>&1'

    #
    # Generate subscriptions
    #
    "/etc/cron.d/generate-subscriptions":
        mode: "000644"
        owner: root
        group: root
        content: |
            30 6 * * Wed root /bin/bash -l -c 'cd /var/app/current && RAILS_ENV=production bin/run_as_webapp bundle exec rake alerts:generate_subscriptions >> log/jobs.log 2>&1'
    #
    # EMail summary of imports
    #
    "/etc/cron.d/notify-amr-imports-daily":
        mode: "000644"
        owner: root
        group: root
        content: |
            45 9 * * * root /bin/bash -l -c 'cd /var/app/current && RAILS_ENV=production bin/run_as_webapp bundle exec rake amr_importer:send_daily_notification_email >> log/jobs.log 2>&1'

    #
    # EMail summary of Rollbar errors from imports
    #
    #"/etc/cron.d/rollbar-reports-daily":
    #    mode: "000644"
    #    owner: root
    #    group: root
    #    content: |
    #        0 9 * * * root /bin/bash -l -c 'cd /var/app/current && RAILS_ENV=production bin/run_as_webapp bundle exec rake utility:custom_rollbar_reports >> log/jobs.log 2>&1'

    #
    # Generate sitemap
    #
    "/etc/cron.d/generate-sitemap-daily":
        mode: "000644"
        owner: root
        group: root
        content: |
            00 1 * * * root /bin/bash -l -c 'cd /var/app/current && RAILS_ENV=production bin/run_as_webapp bundle exec rake "-s sitemap:refresh" >> log/jobs.log 2>&1'

    #
    # Send first target emails weekly on a Monday
    #
    "/etc/cron.d/send-first-target-emails":
        mode: "000644"
        owner: root
        group: root
        content: |
          30 08 * * 1 root /bin/bash -l -c 'cd /var/app/current && RAILS_ENV=production bin/run_as_webapp bundle exec rake targets:send_first_target >> log/jobs.log 2>&1'

    #
    # Send email with recently recorded activities weekly on a Monday
    #
    "/etc/cron.d/send-recent-activities-email":
        mode: "000644"
        owner: root
        group: root
        content: |
          32 08 * * 1 root /bin/bash -l -c 'cd /var/app/current && RAILS_ENV=production bin/run_as_webapp bundle exec rake recent_activities:send_email >> log/jobs.log 2>&1'


    #
    # Send weekly email about target progress to admins
    #
    "/etc/cron.d/send-weekly-admin-target-reports":
        mode: "000644"
        owner: root
        group: root
        content: |
          30 08 * * 5 root /bin/bash -l -c 'cd /var/app/current && RAILS_ENV=production bin/run_as_webapp bundle exec rake targets:admin_report >> log/jobs.log 2>&1'

    #
    # Send issues report to admins weekly on a Monday
    #
    "/etc/cron.d/send-weekly-admin-issue-reports":
        mode: "000644"
        owner: root
        group: root
        content: |
          15 08 * * 1 root /bin/bash -l -c 'cd /var/app/current && RAILS_ENV=production bin/run_as_webapp bundle exec rake issues:send_user_report >> log/jobs.log 2>&1'

    #
    # Resync translations with Transifex on Monday mornings
    #
    "/etc/cron.d/sync-transifex-data":
        mode: "000644"
        owner: root
        group: root
        content: |
          00 08 * * 1 root /bin/bash -l -c 'cd /var/app/current && RAILS_ENV=production bin/run_as_webapp bundle exec rake i18n:transifex_load >> log/jobs.log 2>&1'


    #
    # Delete old alert content
    #
    "/etc/cron.d/delete_alert_content":
        mode: "000644"
        owner: root
        group: root
        content: |
          0 0 1 * * root /bin/bash -l -c 'cd /var/app/current && RAILS_ENV=production bin/run_as_webapp bundle exec rake alerts:delete_alert_content >> log/jobs.log 2>&1'

    #
    # Send Good Job queue metrics to AWS Cloudwatch
    #
    "/etc/cron.d/send-good-job-queue-metrics-to-cloudwatch":
        mode: "000644"
        owner: root
        group: root
        content: |
          */5 * * * * root /bin/bash -l -c 'cd /var/app/current && RAILS_ENV=production bin/run_as_webapp bundle exec rake jobs:send_good_job_queue_metrics_to_cloudwatch >> log/jobs.log 2>&1'

    #
    # Send Review Group Tariffs Reminders
    #
    "/etc/cron.d/send_review_group_tariffs_reminders":
        mode: "000644"
        owner: root
        group: root
        content: |
          0 8 15 3,9 * root /bin/bash -l -c 'cd /var/app/current && RAILS_ENV=production bin/run_as_webapp bundle exec rake school_groups:send_review_group_tariffs_reminder >> log/jobs.log 2>&1'

    #
    # Send Review School Tariffs Reminders
    #
    "/etc/cron.d/send_review_school_tariffs_reminders":
        mode: "000644"
        owner: root
        group: root
        content: |
          0 8 15 3,9 * root /bin/bash -l -c 'cd /var/app/current && RAILS_ENV=production bin/run_as_webapp bundle exec rake schools:send_review_school_tariffs_reminder >> log/jobs.log 2>&1'

    #
    # Send Onboarding Reminder Emails
    #
    "/etc/cron.d/send-daily-onboarding-reminder-emails":
        mode: "000644"
        owner: root
        group: root
        content: |
            00 4 * * * root /bin/bash -l -c 'cd /var/app/current && RAILS_ENV=production bin/run_as_webapp bundle exec rake onboarding:reminder_mailer >> log/jobs.log 2>&1'

# Remove baks else jobs get run twice
commands:
    remove_old_cloudwatch_job:
        command: "rm -rf /etc/cron.d/cwpump"
    remove_good_job_number_of_processes:
        command: "rm -rf /etc/cron.d/send-good-job-number-of-processes-metrics-to-cloudwatch"
    remove_good_job_memory_usage:
        command: "rm -rf /etc/cron.d/send-good-job-memory-usage-metrics-to-cloudwatch"
    remove_old_cron:
        command: "rm -f /etc/cron.d/*.bak"