You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

44 lines
1.8 KiB

  1. #!/bin/bash
  2. ## When writing relation script, remember:
  3. ## - they should be idempotents
  4. ## - they can be launched while the dockers is already up
  5. ## - they are launched from the host
  6. ## - the target of the link is launched first, and get a chance to ``relation-set``
  7. ## - both side of the scripts get to use ``relation-get``.
  8. . lib/common
  9. set -e
  10. ## XXXvlab: should use container name here so that it could support
  11. ## multiple postgres
  12. label=${SERVICE_NAME}
  13. DST=$CONFIGSTORE/$TARGET_SERVICE_NAME/etc/cron/$label
  14. ## XXXvlab: Should we do a 'docker exec' instead ?
  15. bin_console="dc run -u www-data --rm --entrypoint \\\"$GOGOCARTO_DIR/bin/console\\\" $MASTER_BASE_SERVICE_NAME"
  16. ## Warning: 'docker -v' will use HOST directory even if launched from
  17. ## 'cron' container.
  18. file_put "$DST" <<EOF
  19. @daily root lock ${label}-checkvote -D -p 10 -c "\
  20. $bin_console app:elements:checkvote" 2>&1 | ts '\%F \%T \%Z' >> /var/log/cron/${SERVICE_NAME}-checkvote_script.log
  21. @daily root lock ${label}-checkExternalSourceToUpdate -D -p 10 -c "\
  22. $bin_console app:elements:checkExternalSourceToUpdate" 2>&1 | ts '\%F \%T \%Z' >> /var/log/cron/${SERVICE_NAME}-checkExternalSourceToUpdate_script.log
  23. @daily root lock ${label}-notify-moderation -D -p 10 -c "\
  24. $bin_console app:notify-moderation" 2>&1 | ts '\%F \%T \%Z' >> /var/log/cron/${SERVICE_NAME}-notify-moderation_script.log
  25. @hourly root lock ${label}-sendNewsletter -D -p 10 -c "\
  26. $bin_console app:users:sendNewsletter" 2>&1 | ts '\%F \%T \%Z' >> /var/log/cron/${SERVICE_NAME}-sendNewsletter_script.log
  27. */5 * * * * root lock ${label}-webhooks-post -D -p 10 -c "\
  28. $bin_console --env=prod app:webhooks:post" 2>&1 | ts '\%F \%T \%Z' >> /var/log/cron/${SERVICE_NAME}-webhooks-post_script.log
  29. EOF
  30. chmod +x "$DST"