From 21f914ff92a39453623e2180f10c489b9efd2960 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Sat, 3 Apr 2021 10:11:48 +0200 Subject: [PATCH] Add cron --- conf/cron | 1 + scripts/backup | 6 ++++++ scripts/install | 7 +++++++ scripts/remove | 7 +++++++ scripts/restore | 6 ++++++ 5 files changed, 27 insertions(+) create mode 100644 conf/cron diff --git a/conf/cron b/conf/cron new file mode 100644 index 0000000..bc9c1b2 --- /dev/null +++ b/conf/cron @@ -0,0 +1 @@ +* * * * * /usr/bin/php__PHPVERSION__ __FINALPATH__/public/index.php scheduled-activities \ No newline at end of file diff --git a/scripts/backup b/scripts/backup index 6f4f9c1..35163de 100755 --- a/scripts/backup +++ b/scripts/backup @@ -45,6 +45,12 @@ ynh_backup --src_path="$final_path" ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf" +#================================================= +# BACKUP VARIOUS FILES +#================================================= + +ynh_backup --src_path="/etc/cron.d/$app" + #================================================= # BACKUP THE PHP-FPM CONFIGURATION #================================================= diff --git a/scripts/install b/scripts/install index 4f96b62..bfc7fae 100755 --- a/scripts/install +++ b/scripts/install @@ -98,6 +98,13 @@ ynh_script_progression --message="Configuring Castopod..." --weight=1 ynh_add_config --template="../conf/.env.example" --destination="$final_path/.env" +#================================================= +# SETUP A CRON +#================================================= +ynh_script_progression --message="Setuping a cron..." + +ynh_add_config --template="../conf/cron" --destination="/etc/cron.d/$app" + #================================================= # GENERIC FINALIZATION #================================================= diff --git a/scripts/remove b/scripts/remove index 5d4bbf6..f0dd710 100755 --- a/scripts/remove +++ b/scripts/remove @@ -53,6 +53,13 @@ ynh_script_progression --message="Removing PHP-FPM configuration..." --weight=2 # Remove the dedicated PHP-FPM config ynh_remove_fpm_config +#================================================= +# REMOVE VARIOUS FILES +#================================================= + +# Remove a cron file +ynh_secure_remove --file="/etc/cron.d/$app" + #================================================= # GENERIC FINALIZATION #================================================= diff --git a/scripts/restore b/scripts/restore index d21b214..72bfb17 100755 --- a/scripts/restore +++ b/scripts/restore @@ -91,6 +91,12 @@ db_pwd=$(ynh_app_setting_get --app=$app --key=mysqlpwd) ynh_mysql_setup_db --db_user=$db_user --db_name=$db_name --db_pwd=$db_pwd ynh_mysql_connect_as --user=$db_user --password=$db_pwd --database=$db_name < ./db.sql +#================================================= +# RESTORE VARIOUS FILES +#================================================= + +ynh_restore_file --origin_path="/etc/cron.d/$app" + #================================================= # GENERIC FINALIZATION #=================================================