From 5e78b6e62ee2937f9fbe1557aced448921b66884 Mon Sep 17 00:00:00 2001 From: Jean-Baptiste Holcroft Date: Wed, 13 Jun 2018 23:49:24 +0200 Subject: [PATCH] Improve cron file --- conf/cron | 6 +++--- scripts/install | 1 + scripts/upgrade | 7 +++++++ 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/conf/cron b/conf/cron index 86c40be..08f59d1 100644 --- a/conf/cron +++ b/conf/cron @@ -1,9 +1,9 @@ # https://docs.weblate.org/en/latest/admin/install.html#production-cron # Fulltext index updates -*/5 * * * * weblate DJANGO_SETTINGS_MODULE="weblate.settings" __FINALPATH__/venv/bin/weblate update_index +*/5 * * * * __APP__ export DJANGO_SETTINGS_MODULE="weblate.settings" && cd __FINALPATH__ && venv/bin/weblate update_index # Cleanup stale objects -@daily weblate DJANGO_SETTINGS_MODULE="weblate.settings" __FINALPATH__/venv/bin/weblate cleanuptrans +@daily __APP__ export DJANGO_SETTINGS_MODULE="weblate.settings" && cd __FINALPATH__ && venv/bin/weblate cleanuptrans # Commit pending changes after 96 hours -@hourly weblate DJANGO_SETTINGS_MODULE="weblate.settings" __FINALPATH__/venv/bin/weblate commit_pending --all --age=96 --verbosity=0 +@hourly __APP__ export DJANGO_SETTINGS_MODULE="weblate.settings" && cd __FINALPATH__ && venv/bin/weblate commit_pending --all --age=96 --verbosity=0 diff --git a/scripts/install b/scripts/install index 2dc9a2d..1e7d764 100755 --- a/scripts/install +++ b/scripts/install @@ -239,6 +239,7 @@ ynh_app_setting_set "$app" memc_port "$memc_port" # SETUP CRON #================================================= cp ../conf/cron "/etc/cron.d/$app" +ynh_replace_string "__APP__" "$app" "/etc/cron.d/$app" ynh_replace_string "__FINALPATH__" "$final_path/" "/etc/cron.d/$app" #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index 5c87db3..94f8844 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -270,6 +270,13 @@ fi # Recalculate and store the config file checksum into the app settings ynh_store_file_checksum "$final_path/venv/lib/python2.7/site-packages/weblate/settings.py" +#================================================= +# SETUP CRON +#================================================= +cp ../conf/cron "/etc/cron.d/$app" +ynh_replace_string "__APP__" "$app" "/etc/cron.d/$app" +ynh_replace_string "__FINALPATH__" "$final_path/" "/etc/cron.d/$app" + #================================================= # GENERIC FINALIZATION #=================================================