diff --git a/clevercloud/add_user_to_list_when_register.sh b/clevercloud/add_user_to_list_when_register.sh deleted file mode 100755 index 526272f37..000000000 --- a/clevercloud/add_user_to_list_when_register.sh +++ /dev/null @@ -1,18 +0,0 @@ -#!/bin/bash -l - -# Collect Daily Matomo Stats - -# -# About clever cloud cronjobs: -# https://www.clever-cloud.com/doc/tools/crons/ -# - -if [[ "$INSTANCE_NUMBER" != "0" ]]; then - echo "Instance number is ${INSTANCE_NUMBER}. Stop here." - exit 0 -fi - -# $APP_HOME is set by default by clever cloud. -cd $APP_HOME - -python manage.py add_user_to_list_when_register diff --git a/clevercloud/collect_daily_django_stats.sh b/clevercloud/collect_daily_django_stats.sh deleted file mode 100755 index f41459d9d..000000000 --- a/clevercloud/collect_daily_django_stats.sh +++ /dev/null @@ -1,18 +0,0 @@ -#!/bin/bash -l - -# Collect Daily Matomo Stats - -# -# About clever cloud cronjobs: -# https://www.clever-cloud.com/doc/tools/crons/ -# - -if [[ "$INSTANCE_NUMBER" != "0" ]]; then - echo "Instance number is ${INSTANCE_NUMBER}. Stop here." - exit 0 -fi - -# $APP_HOME is set by default by clever cloud. -cd $APP_HOME - -python manage.py collect_django_stats diff --git a/clevercloud/collect_daily_matomo_stats.sh b/clevercloud/collect_daily_matomo_stats.sh deleted file mode 100755 index 0799eb092..000000000 --- a/clevercloud/collect_daily_matomo_stats.sh +++ /dev/null @@ -1,18 +0,0 @@ -#!/bin/bash -l - -# Collect Daily Matomo Stats - -# -# About clever cloud cronjobs: -# https://www.clever-cloud.com/doc/tools/crons/ -# - -if [[ "$INSTANCE_NUMBER" != "0" ]]; then - echo "Instance number is ${INSTANCE_NUMBER}. Stop here." - exit 0 -fi - -# $APP_HOME is set by default by clever cloud. -cd $APP_HOME - -python manage.py collect_matomo_stats diff --git a/clevercloud/collect_monthly_matomo_stats.sh b/clevercloud/collect_monthly_matomo_stats.sh deleted file mode 100755 index 0e502e52c..000000000 --- a/clevercloud/collect_monthly_matomo_stats.sh +++ /dev/null @@ -1,18 +0,0 @@ -#!/bin/bash -l - -# Collect Daily Matomo Stats - -# -# About clever cloud cronjobs: -# https://www.clever-cloud.com/doc/tools/crons/ -# - -if [[ "$INSTANCE_NUMBER" != "0" ]]; then - echo "Instance number is ${INSTANCE_NUMBER}. Stop here." - exit 0 -fi - -# $APP_HOME is set by default by clever cloud. -cd $APP_HOME - -python manage.py collect_matomo_stats --period month diff --git a/clevercloud/collect_weekly_matomo_forum_stats.sh b/clevercloud/collect_weekly_matomo_forum_stats.sh deleted file mode 100755 index 494ddf3e4..000000000 --- a/clevercloud/collect_weekly_matomo_forum_stats.sh +++ /dev/null @@ -1,18 +0,0 @@ -#!/bin/bash -l - -# Collect Daily Matomo Stats - -# -# About clever cloud cronjobs: -# https://www.clever-cloud.com/doc/tools/crons/ -# - -if [[ "$INSTANCE_NUMBER" != "0" ]]; then - echo "Instance number is ${INSTANCE_NUMBER}. Stop here." - exit 0 -fi - -# $APP_HOME is set by default by clever cloud. -cd $APP_HOME - -python manage.py collect_matomo_forum_stats diff --git a/clevercloud/cron.json b/clevercloud/cron.json index 9089a62b8..7cbd5eaf8 100644 --- a/clevercloud/cron.json +++ b/clevercloud/cron.json @@ -1,11 +1,12 @@ [ "*/10 * * * * $ROOT/clevercloud/rebuild_index.sh", - "0 7 * * * $ROOT/clevercloud/collect_daily_matomo_stats.sh", - "5 7 * * * $ROOT/clevercloud/collect_daily_django_stats.sh", - "10 7 1 * * $ROOT/clevercloud/collect_monthly_matomo_stats.sh", - "15 7 * * 1 $ROOT/clevercloud/collect_weekly_matomo_forum_stats.sh", - "*/15 7-21 * * * $ROOT/clevercloud/send_notifications_regular.sh", - "20 6 * * * $ROOT/clevercloud/send_notifications_daily.sh", - "10 6-22 * * * $ROOT/clevercloud/add_user_to_list_when_register.sh", - "30 13 * * 1-5 $ROOT/clevercloud/send_notifs_on_unanswered_topics_list.sh" + "0 3 * * * $ROOT/clevercloud/run_management_command.sh clearsessions", + "0 7 * * * $ROOT/clevercloud/run_management_command.sh collect_matomo_stats", + "5 7 * * * $ROOT/clevercloud/run_management_command.sh collect_django_stats", + "10 7 1 * * $ROOT/clevercloud/run_management_command.sh collect_matomo_stats --period month", + "15 7 * * 1 $ROOT/clevercloud/run_management_command.sh collect_matomo_forum_stats", + "*/15 7-21 * * * $ROOT/clevercloud/run_management_command.sh send_messages_notifications asap", + "20 6 * * * $ROOT/clevercloud/run_management_command.sh send_messages_notifications day", + "10 6-22 * * * $ROOT/clevercloud/run_management_command.sh add_user_to_list_when_register", + "30 13 * * 1-5 $ROOT/clevercloud/run_management_command.sh send_notifs_on_unanswered_topics" ] diff --git a/clevercloud/send_notifs_on_unanswered_topics_list.sh b/clevercloud/run_management_command.sh similarity index 84% rename from clevercloud/send_notifs_on_unanswered_topics_list.sh rename to clevercloud/run_management_command.sh index 8839b480a..c9e363523 100755 --- a/clevercloud/send_notifs_on_unanswered_topics_list.sh +++ b/clevercloud/run_management_command.sh @@ -1,5 +1,6 @@ #!/bin/bash -l +set -ue # # About clever cloud cronjobs: @@ -14,4 +15,4 @@ fi # $APP_HOME is set by default by clever cloud. cd $APP_HOME -python manage.py send_notifs_on_unanswered_topics +python manage.py "$@" diff --git a/clevercloud/send_notifications_daily.sh b/clevercloud/send_notifications_daily.sh deleted file mode 100755 index 6cc98d4b2..000000000 --- a/clevercloud/send_notifications_daily.sh +++ /dev/null @@ -1,18 +0,0 @@ -#!/bin/bash -l - -# Variation of a cronjob which sends notifications that have been marked to send the following day - -# -# About clever cloud cronjobs: -# https://next-www.cleverapps.io/doc/administrate/cron/ -# - -if [[ "$INSTANCE_NUMBER" != "0" ]]; then - echo "Instance number is ${INSTANCE_NUMBER}. Stop here." - exit 0 -fi - -# $APP_HOME is set by default by clever cloud. -cd $APP_HOME - -python manage.py send_messages_notifications day diff --git a/clevercloud/send_notifications_regular.sh b/clevercloud/send_notifications_regular.sh deleted file mode 100755 index cd806f7e2..000000000 --- a/clevercloud/send_notifications_regular.sh +++ /dev/null @@ -1,18 +0,0 @@ -#!/bin/bash -l - -# Variation of a cronjob which sends notifications that have been marked to send ASAP - -# -# About clever cloud cronjobs: -# https://next-www.cleverapps.io/doc/administrate/cron/ -# - -if [[ "$INSTANCE_NUMBER" != "0" ]]; then - echo "Instance number is ${INSTANCE_NUMBER}. Stop here." - exit 0 -fi - -# $APP_HOME is set by default by clever cloud. -cd $APP_HOME - -python manage.py send_messages_notifications asap