From 9122f1dc2e83290b8ec83d449f48208bfbb40cc7 Mon Sep 17 00:00:00 2001 From: Kayou Date: Fri, 23 Aug 2024 11:36:41 +0200 Subject: [PATCH] run cron task after notify push setup --- scripts/install | 48 +++++++++++++++++++++++------------------------- scripts/upgrade | 25 ++++++++++++------------- 2 files changed, 35 insertions(+), 38 deletions(-) diff --git a/scripts/install b/scripts/install index a11733d..25d79af 100755 --- a/scripts/install +++ b/scripts/install @@ -203,6 +203,29 @@ exec_occ config:app:set dav system_addressbook_exposed --value="$system_addressb # Calculate and store the config file checksum into the app settings ynh_store_file_checksum --file="$install_dir/config/config.php" +#================================================= +# CONFIGURE NOTIFY_PUSH APP +#================================================= + +if [ $enable_notify_push -eq 1 ] +then + exec_occ app:install notify_push + exec_occ config:app:set notify_push base_endpoint --value https://$domain${path_url%/}/push + + mkdir -p /var/run/$app/ + chown $app: /var/run/$app/ + + case $YNH_ARCH in + amd64) arch="x86_64";; + arm64) arch="aarch64";; + armel|armhf) arch="armv7";; + esac + + ynh_add_systemd_config --service="${app}-notify-push" + ynh_add_systemd_config --service="${app}-notify-push-watcher" --template="watcher.service" + ynh_add_config --template="watcher.path" --destination="/etc/systemd/system/${app}-notify-push-watcher.path" +fi + #================================================= # ADD A CRON JOB #================================================= @@ -236,29 +259,6 @@ create_external_storage "/home/yunohost.multimedia/share" "Shared multimedia" # Allow nextcloud to write into these directories ynh_multimedia_addaccess $app -#================================================= -# CONFIGURE NOTIFY_PUSH APP -#================================================= - -if [ $enable_notify_push -eq 1 ] -then - exec_occ app:install notify_push - exec_occ config:app:set notify_push base_endpoint --value https://$domain${path_url%/}/push - - mkdir -p /var/run/$app/ - chown $app: /var/run/$app/ - - case $YNH_ARCH in - amd64) arch="x86_64";; - arm64) arch="aarch64";; - armel|armhf) arch="armv7";; - esac - - ynh_add_systemd_config --service="${app}-notify-push" - ynh_add_systemd_config --service="${app}-notify-push-watcher" --template="watcher.service" - ynh_add_config --template="watcher.path" --destination="/etc/systemd/system/${app}-notify-push-watcher.path" -fi - #================================================= # GENERIC FINALIZATION #================================================= @@ -298,8 +298,6 @@ ynh_add_fail2ban_config --logpath="/var/log/$app/nextcloud.log" --failregex="^.* if [ $enable_notify_push -eq 1 ] then - ynh_exec_as "$app" php${phpversion} --define apc.enable_cli=1 $install_dir/cron.php - ynh_systemd_action --service_name="${app}-notify-push-watcher" --action=restart ynh_systemd_action --service_name="${app}-notify-push" --action=restart --line_match="Push daemon for Nextcloud clients." --log_path="systemd" diff --git a/scripts/upgrade b/scripts/upgrade index 2aecbfe..6614619 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -382,17 +382,6 @@ fi # Create a dedicated NGINX config ynh_add_nginx_config -#================================================= -# CRON JOB -#================================================= - -cron_path="/etc/cron.d/$app" -ynh_add_config --template="nextcloud.cron" --destination="$cron_path" -chown root: "$cron_path" -chmod 644 "$cron_path" - -exec_occ background:cron - #================================================= # CONFIGURE NOTIFY_PUSH APP #================================================= @@ -422,6 +411,18 @@ then ynh_add_config --template="watcher.path" --destination="/etc/systemd/system/${app}-notify-push-watcher.path" fi + +#================================================= +# CRON JOB +#================================================= + +cron_path="/etc/cron.d/$app" +ynh_add_config --template="nextcloud.cron" --destination="$cron_path" +chown root: "$cron_path" +chmod 644 "$cron_path" + +exec_occ background:cron + #================================================= # LOGROTATE #================================================= @@ -441,8 +442,6 @@ ynh_add_fail2ban_config --logpath="/var/log/$app/nextcloud.log" --failregex="^.* if [ $enable_notify_push -eq 1 ] then - ynh_exec_as "$app" php${phpversion} --define apc.enable_cli=1 $install_dir/cron.php - ynh_systemd_action --service_name="${app}-notify-push-watcher" --action=restart ynh_systemd_action --service_name="${app}-notify-push" --action=restart --line_match="Push daemon for Nextcloud clients." --log_path="systemd" --action=restart