From 4f1e347d60068895068f3fe1c03a0aa4967fb4eb Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Fri, 11 Dec 2020 17:20:31 +0100 Subject: [PATCH] setup cron --- scripts/change_url | 14 ++++++++++++++ scripts/upgrade | 17 +++++++---------- 2 files changed, 21 insertions(+), 10 deletions(-) diff --git a/scripts/change_url b/scripts/change_url index c6cfed0..380353e 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -28,6 +28,7 @@ ynh_script_progression --message="Loading installation settings..." --weight=1 # Needed for helper "ynh_add_nginx_config" final_path=$(ynh_app_setting_get --app=$app --key=final_path) +phpversion=$(ynh_app_setting_get --app=$app --key=phpversion) #================================================= # BACKUP BEFORE UPGRADE THEN ACTIVE TRAP @@ -91,6 +92,19 @@ then ynh_store_file_checksum --file="/etc/nginx/conf.d/$new_domain.d/$app.conf" fi +#================================================= +# SETUP A CRON +#================================================= +ynh_script_progression --message="Setuping a cron..." + +cp ../conf/matomo.cron /etc/cron.d/$app + +ynh_replace_string --match_string="__FINALPATH__" --replace_string="$final_path" --target_file="/etc/cron.d/$app" +ynh_replace_string --match_string="__APP__" --replace_string="$app" --target_file="/etc/cron.d/$app" +ynh_replace_string --match_string="__DOMAIN__" --replace_string="$new_domain" --target_file="/etc/cron.d/$app" +ynh_replace_string --match_string="__PATH__" --replace_string="$new_path" --target_file="/etc/cron.d/$app" +ynh_replace_string --match_string="__PHPVERSION__" --replace_string="$phpversion" --target_file="/etc/cron.d/$app" + #================================================= # RELOAD NGINX #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index c0552f9..c7faa48 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -151,18 +151,15 @@ fi #================================================= # SETUP A CRON #================================================= -# ynh_script_progression --message="Setuping a cron..." +ynh_script_progression --message="Setuping a cron..." -# cron_path="/etc/cron.d/$app" -# cp -a ../conf/matomo.cron "$cron_path" -# chown root: "$cron_path" -# chmod 644 "$cron_path" +cp ../conf/matomo.cron /etc/cron.d/$app -# ynh_replace_string --match_string="__FINALPATH__" --replace_string="$final_path" --target_file="$cron_path" -# ynh_replace_string --match_string="__APP__" --replace_string="$app" --target_file="$cron_path" -# ynh_replace_string --match_string="__DOMAIN__" --replace_string="$domain" --target_file="$cron_path" -# ynh_replace_string --match_string="__PATH__" --replace_string="$path_url" --target_file="$cron_path" -# ynh_replace_string --match_string="__PHPVERSION__" --replace_string="$phpversion" --target_file="$cron_path" +ynh_replace_string --match_string="__FINALPATH__" --replace_string="$final_path" --target_file="/etc/cron.d/$app" +ynh_replace_string --match_string="__APP__" --replace_string="$app" --target_file="/etc/cron.d/$app" +ynh_replace_string --match_string="__DOMAIN__" --replace_string="$domain" --target_file="/etc/cron.d/$app" +ynh_replace_string --match_string="__PATH__" --replace_string="$path_url" --target_file="/etc/cron.d/$app" +ynh_replace_string --match_string="__PHPVERSION__" --replace_string="$phpversion" --target_file="/etc/cron.d/$app" #================================================= # GENERIC FINALIZATION