From 3e2a288ad7c5c5224de60671ec5ab48871bece14 Mon Sep 17 00:00:00 2001 From: Sebastian Gumprich Date: Sat, 9 May 2020 21:20:43 +0200 Subject: [PATCH 1/3] add cronjobs --- README.md | 8 ++------ conf/invoiceninja.cron | 3 +++ scripts/install | 10 ++++++++++ 3 files changed, 15 insertions(+), 6 deletions(-) create mode 100644 conf/invoiceninja.cron 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..7e78cfd --- /dev/null +++ b/conf/invoiceninja.cron @@ -0,0 +1,3 @@ +0 8 * * * /var/www/invoiceninja/artisan ninja:send-invoices +0 8 * * * /var/www/invoiceninja/artisan ninja:send-reminders + diff --git a/scripts/install b/scripts/install index 5165446..98a64cf 100755 --- a/scripts/install +++ b/scripts/install @@ -239,6 +239,16 @@ ynh_script_progression --message="Configuring log rotation..." --time --weight=1 # 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" + + #================================================= # SETUP FAIL2BAN #================================================= From 7406db467397877ee27f1a58f48bdae75571ed1f Mon Sep 17 00:00:00 2001 From: Sebastian Gumprich Date: Sat, 9 May 2020 21:41:54 +0200 Subject: [PATCH 2/3] fix cron --- conf/invoiceninja.cron | 4 ++-- scripts/install | 5 +++++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/conf/invoiceninja.cron b/conf/invoiceninja.cron index 7e78cfd..0c6bf67 100644 --- a/conf/invoiceninja.cron +++ b/conf/invoiceninja.cron @@ -1,3 +1,3 @@ -0 8 * * * /var/www/invoiceninja/artisan ninja:send-invoices -0 8 * * * /var/www/invoiceninja/artisan ninja:send-reminders +0 8 * * * __USER__ /usr/bin/php__YNH_PHP_VERSION__ __DESTDIR__/artisan ninja:send-invoices +0 8 * * * __USER__ /usr/bin/php__YNH_PHP_VERSION__ __DESTDIR__/artisan ninja:send-reminders diff --git a/scripts/install b/scripts/install index 98a64cf..37aff6d 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 @@ -248,6 +250,9 @@ 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 From e9fdff2d51e78dd4c10207fa277366dfba846e21 Mon Sep 17 00:00:00 2001 From: Sebastian Gumprich Date: Sun, 10 May 2020 21:00:34 +0200 Subject: [PATCH 3/3] do not display output of cronjobs --- conf/invoiceninja.cron | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/conf/invoiceninja.cron b/conf/invoiceninja.cron index 0c6bf67..14ded0d 100644 --- a/conf/invoiceninja.cron +++ b/conf/invoiceninja.cron @@ -1,3 +1,3 @@ -0 8 * * * __USER__ /usr/bin/php__YNH_PHP_VERSION__ __DESTDIR__/artisan ninja:send-invoices -0 8 * * * __USER__ /usr/bin/php__YNH_PHP_VERSION__ __DESTDIR__/artisan ninja:send-reminders +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