diff --git a/schedule/extra/01_optimize_hydra.xml b/schedule/extra/01_optimize_hydra.xml new file mode 100644 index 0000000..d9b109a --- /dev/null +++ b/schedule/extra/01_optimize_hydra.xml @@ -0,0 +1,20 @@ + + + + + + + daily + + + + + + + non + dbEnableBackup + none + daily + + + diff --git a/schedule/scripts/optimize_hydra b/schedule/scripts/optimize_hydra new file mode 100644 index 0000000..809274c --- /dev/null +++ b/schedule/scripts/optimize_hydra @@ -0,0 +1,46 @@ +#!/bin/bash + +DESC="Optimize sur les tables d'Hydra" + +. /usr/share/eole/schedule/config.sh + +echo "Begin date: $(date)" + +day=$(date '+%u') # 1 == Monday + +case $day in + 1) + tables='hydra_oauth2_access' + ;; + 2) + tables='hydra_oauth2_oidc' + ;; + 3) + tables='hydra_oauth2_code' + ;; + 4) + tables='hydra_oauth2_authentication_request' + ;; + 5) + tables='hydra_oauth2_consent_request' + ;; + 6) + tables='hydra_oauth2_logout_request, hydra_oauth2_consent_request_handled' + ;; + 7) + tables='hydra_oauth2_authentication_session, hydra_oauth2_authentication_request_handled, hydra_oauth2_pkce' + ;; + *) + echo 'Unexpected error. Day: $day' + exit 1 +esac + +mysql --defaults-file=/etc/mysql/debian.cnf hydra <