diff --git a/conf/phpbb.cron b/conf/phpbb.cron new file mode 100644 index 0000000..469dc1b --- /dev/null +++ b/conf/phpbb.cron @@ -0,0 +1 @@ +* * * * * __APP__ /usr/bin/php__PHPVERSION__ -f __FINAL_PATH__/bin/phpbbcli.php cron:run \ No newline at end of file diff --git a/scripts/backup b/scripts/backup index b93a5ca..b6cad37 100644 --- a/scripts/backup +++ b/scripts/backup @@ -52,6 +52,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 THE CRON FILE +#================================================= + +ynh_backup --src_path="/etc/cron.d/$app" + #================================================= # BACKUP THE MYSQL DATABASE #================================================= diff --git a/scripts/install b/scripts/install index 683943c..3fb4d4e 100644 --- a/scripts/install +++ b/scripts/install @@ -120,8 +120,14 @@ ynh_exec_as "$app" php${phpversion} "$final_path/install/phpbbcli.php" -q --no-i mv "$final_path/install" "$final_path/install_old" -# Remove the public access -ynh_permission_update --permission="main" --remove="visitors" +#================================================= +# ADD A CRON JOB +#================================================= + +cron_path="/etc/cron.d/$app" +ynh_add_config --template="../conf/phpbb.cron" --destination="$cron_path" +chown root: "$cron_path" +chmod 644 "$cron_path" #================================================= # INTEGRATE SERVICE IN YUNOHOST diff --git a/scripts/remove b/scripts/remove index 6c5e664..63b1d85 100644 --- a/scripts/remove +++ b/scripts/remove @@ -67,6 +67,12 @@ ynh_script_progression --message="Removing PHP-FPM configuration..." --weight=1 # Remove the dedicated PHP-FPM config ynh_remove_fpm_config +#================================================= +# REMOVE THE CRON FILE +#================================================= + +ynh_secure_remove --file="/etc/cron.d/$app" + #================================================= # GENERIC FINALIZATION #================================================= diff --git a/scripts/restore b/scripts/restore index 3feec35..cbf519f 100644 --- a/scripts/restore +++ b/scripts/restore @@ -85,6 +85,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 THE CRON FILE +#================================================= + +ynh_restore_file --origin_path="/etc/cron.d/$app" + #================================================= # INTEGRATE SERVICE IN YUNOHOST #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index 2cdd2a8..4bc02a1 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -135,6 +135,15 @@ if [ -e "$final_path/install" ]; then mv "$final_path/install" "$final_path/install_old" fi +#================================================= +# ADD A CRON JOB +#================================================= + +cron_path="/etc/cron.d/$app" +ynh_add_config --template="../conf/phpbb.cron" --destination="$cron_path" +chown root: "$cron_path" +chmod 644 "$cron_path" + #================================================= # INTEGRATE SERVICE IN YUNOHOST #=================================================