From c8a764154cd60ef94e2de2c38c990d86ac680888 Mon Sep 17 00:00:00 2001 From: Kay0u Date: Sun, 7 Feb 2021 17:05:09 +0100 Subject: [PATCH] Add the cron job --- scripts/backup | 10 ++++++++-- scripts/install | 6 ++++++ scripts/remove | 6 ++++++ scripts/restore | 6 ++++++ scripts/upgrade | 6 ++++++ 5 files changed, 32 insertions(+), 2 deletions(-) diff --git a/scripts/backup b/scripts/backup index aeba9fc..553bb8f 100644 --- a/scripts/backup +++ b/scripts/backup @@ -45,13 +45,19 @@ ynh_backup --src_path="$final_path" # BACKUP THE NGINX CONFIGURATION #================================================= -ynh_backup "/etc/nginx/conf.d/$domain.d/$app.conf" +ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf" #================================================= # BACKUP THE PHP-FPM CONFIGURATION #================================================= -ynh_backup "/etc/php/${phpversion}/fpm/pool.d/$app.conf" +ynh_backup --src_path="/etc/php/${phpversion}/fpm/pool.d/$app.conf" + +#================================================= +# BACKUP CRON +#================================================= + +ynh_backup --src_path="/etc/cron.d/$app" #================================================= # END OF SCRIPT diff --git a/scripts/install b/scripts/install index 85f383a..a29c0c0 100644 --- a/scripts/install +++ b/scripts/install @@ -118,6 +118,12 @@ ynh_replace_string "__ADMIN__" "$admin" "$final_path/user/plugins/login-ldap/log ynh_replace_string "__APP__" "$app" "$final_path/user/plugins/login-ldap/login-ldap.yaml" exec_as $app cp "$final_path/user/plugins/login-ldap/login-ldap.yaml" "$final_path/user/config/plugins/login-ldap.yaml" +#================================================= +# CREATE A CRON TASK +#================================================= + +echo "* * * * * $app php$phpversion $final_path/bin/grav scheduler 1>> /dev/null 2>&1" > /etc/cron.d/$app + #================================================= # SETUP PERMISSIONS #================================================= diff --git a/scripts/remove b/scripts/remove index 6ef4967..4999b4f 100644 --- a/scripts/remove +++ b/scripts/remove @@ -31,6 +31,12 @@ ynh_script_progression --message="Removing dependencies..." --weight=2 # Remove metapackage and its dependencies ynh_remove_app_dependencies +#================================================= +# REMOVE THE CRON +#================================================= + +ynh_secure_remove --file="/etc/cron.d/$app" + #================================================= # REMOVE APP MAIN DIR #================================================= diff --git a/scripts/restore b/scripts/restore index b7f6c90..d41e85a 100644 --- a/scripts/restore +++ b/scripts/restore @@ -79,6 +79,12 @@ find $final_path/bin -type f -exec chmod 775 {} \; find $final_path -type d -exec chmod 775 {} \; find $final_path -type d -exec chmod +s {} \; +#================================================= +# RESTORE THE CRON +#================================================= + +ynh_restore_file --origin_path="/etc/cron.d/$app" + #================================================= # RESTORE THE PHP-FPM CONFIGURATION #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index 39bdcf2..f6b041a 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -183,6 +183,12 @@ ynh_replace_string "__ADMIN__" "$admin" "$final_path/user/plugins/login-ldap/log ynh_replace_string "__APP__" "$app" "$final_path/user/plugins/login-ldap/login-ldap.yaml" exec_as $app cp "$final_path/user/plugins/login-ldap/login-ldap.yaml" "$final_path/user/config/plugins/login-ldap.yaml" +#================================================= +# CREATE A CRON TASK +#================================================= + +echo "* * * * * $app php$phpversion $final_path/bin/grav scheduler 1>> /dev/null 2>&1" > /etc/cron.d/$app + #================================================= # SETUP PERMISSIONS #=================================================