diff --git a/README.md b/README.md index 1d93e28..05022f5 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # Invoice Ninja for YunoHost -[![Integration level](https://dash.yunohost.org/integration/invoiceninja.svg)](https://dash.yunohost.org/appci/app/invoiceninja) +[![Integration level](https://dash.yunohost.org/integration/invoiceninja.svg)](https://dash.yunohost.org/appci/app/invoiceninja) [![Install invoiceninja with YunoHost](https://install-app.yunohost.org/install-with-yunohost.png)](https://install-app.yunohost.org/?app=invoiceninja) > *This package allow you to install invoiceninja quickly and simply on a YunoHost server. @@ -52,11 +52,7 @@ Configuration happens in the application itself. * Upstream app repository: https://github.com/invoiceninja/invoiceninja * YunoHost website: https://yunohost.org/ - ## TODOs -* Completely configure the env -* Mail settings -* Cronjobs -* Create initial user? +* If possible, create initial user * Test upgrade diff --git a/conf/invoiceninja.cron b/conf/invoiceninja.cron new file mode 100644 index 0000000..14ded0d --- /dev/null +++ b/conf/invoiceninja.cron @@ -0,0 +1,3 @@ +0 8 * * * __USER__ /usr/bin/php__YNH_PHP_VERSION__ __DESTDIR__/artisan ninja:send-invoices -q +0 8 * * * __USER__ /usr/bin/php__YNH_PHP_VERSION__ __DESTDIR__/artisan ninja:send-reminders -q + diff --git a/scripts/install b/scripts/install index 22221fd..bc04548 100755 --- a/scripts/install +++ b/scripts/install @@ -24,6 +24,8 @@ ynh_abort_if_errors # RETRIEVE ARGUMENTS FROM THE MANIFEST #================================================= +YNH_PHP_VERSION="7.0" + domain=$YNH_APP_ARG_DOMAIN path_url=$YNH_APP_ARG_PATH admin=$YNH_APP_ARG_ADMIN @@ -239,6 +241,19 @@ ynh_script_progression --message="Configuring log rotation..." # Use logrotate to manage application logfile(s) ynh_use_logrotate +#================================================= +# ADD A CRON JOB +#================================================= + +cron_path="/etc/cron.d/$app" +cp -a ../conf/invoiceninja.cron "$cron_path" +chown root: "$cron_path" +chmod 644 "$cron_path" + +ynh_replace_string --match_string="__USER__" --replace_string="$app" --target_file="$cron_path" +ynh_replace_string --match_string="__DESTDIR__" --replace_string="$final_path" --target_file="$cron_path" +ynh_replace_string --match_string="__YNH_PHP_VERSION__" --replace_string="$YNH_PHP_VERSION" --target_file="$cron_path" + #================================================= # SETUP FAIL2BAN #=================================================