From 73934d0e7d69f285ecf2c239bdf8deee275a8e0e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Fri, 6 Oct 2023 22:38:34 +0200 Subject: [PATCH] cron --- conf/config.local.php | 2 +- conf/cron | 2 ++ scripts/backup | 6 ++++++ scripts/install | 4 ++++ scripts/remove | 3 +++ scripts/restore | 4 ++++ scripts/upgrade | 4 ++++ 7 files changed, 24 insertions(+), 1 deletion(-) create mode 100644 conf/cron diff --git a/conf/config.local.php b/conf/config.local.php index 2b3b66e..25e80d0 100644 --- a/conf/config.local.php +++ b/conf/config.local.php @@ -348,7 +348,7 @@ const ENABLE_UPGRADES = false; * Défaut : false */ -//const USE_CRON = false; +const USE_CRON = true; /** * Activation de l'envoi de fichier directement par le serveur web. diff --git a/conf/cron b/conf/cron new file mode 100644 index 0000000..4a4c95f --- /dev/null +++ b/conf/cron @@ -0,0 +1,2 @@ +@daily __APP__ /usr/bin/php__PHPVERSION__ __INSTALL_DIR__/scripts/cron.php +* * * * * __APP__ /usr/bin/php__PHPVERSION__ __INSTALL_DIR__/scripts/emails.php \ No newline at end of file diff --git a/scripts/backup b/scripts/backup index 62ffbee..3d4fbfa 100644 --- a/scripts/backup +++ b/scripts/backup @@ -39,6 +39,12 @@ ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf" ynh_backup --src_path="/etc/php/$phpversion/fpm/pool.d/$app.conf" +#================================================= +# BACKUP VARIOUS FILES +#================================================= + +ynh_backup --src_path="/etc/cron.d/$app" + #================================================= # END OF SCRIPT #================================================= diff --git a/scripts/install b/scripts/install index 202c7b4..fd51e6c 100644 --- a/scripts/install +++ b/scripts/install @@ -34,6 +34,10 @@ ynh_add_fpm_config # Create a dedicated NGINX config ynh_add_nginx_config +ynh_add_config --template="../conf/cron" --destination="/etc/cron.d/$app" +chown root: "/etc/cron.d/$app" +chmod 644 "/etc/cron.d/$app" + #================================================= # SPECIFIC SETUP #================================================= diff --git a/scripts/remove b/scripts/remove index 5b17c2d..b88f6a3 100644 --- a/scripts/remove +++ b/scripts/remove @@ -20,6 +20,9 @@ ynh_remove_nginx_config # Remove the dedicated PHP-FPM config ynh_remove_fpm_config +# Remove a cron file +ynh_secure_remove --file="/etc/cron.d/$app" + #================================================= # END OF SCRIPT #================================================= diff --git a/scripts/restore b/scripts/restore index 2102651..640730b 100644 --- a/scripts/restore +++ b/scripts/restore @@ -39,6 +39,10 @@ ynh_restore_file --origin_path="/etc/php/$phpversion/fpm/pool.d/$app.conf" ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf" +ynh_restore_file --origin_path="/etc/cron.d/$app" +chown root: "/etc/cron.d/$app" +chmod 644 "/etc/cron.d/$app" + #================================================= # GENERIC FINALIZATION #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index 674c1dd..8580bdb 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -59,6 +59,10 @@ ynh_add_fpm_config # Create a dedicated NGINX config ynh_add_nginx_config +ynh_add_config --template="../conf/cron" --destination="/etc/cron.d/$app" +chown root: "/etc/cron.d/$app" +chmod 644 "/etc/cron.d/$app" + #================================================= # SPECIFIC UPGRADE #=================================================