From 105a7b020f8dc0e8752dea5b99476b19daf7b255 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Mon, 21 Aug 2023 18:39:17 +0200 Subject: [PATCH] fix --- conf/cron | 2 ++ conf/systemd.service | 22 ---------------------- scripts/backup | 2 +- scripts/install | 14 +++----------- scripts/remove | 9 --------- scripts/restore | 8 ++------ 6 files changed, 8 insertions(+), 49 deletions(-) create mode 100644 conf/cron delete mode 100644 conf/systemd.service diff --git a/conf/cron b/conf/cron new file mode 100644 index 0000000..e7e5fd1 --- /dev/null +++ b/conf/cron @@ -0,0 +1,2 @@ +# Run poller periodically to update Friendica +*/10 * * * * __APP__ /usr/bin/php__PHPVERSION__ -f __INSTALL_DIR__/bin/worker.php \ No newline at end of file diff --git a/conf/systemd.service b/conf/systemd.service deleted file mode 100644 index 9f00342..0000000 --- a/conf/systemd.service +++ /dev/null @@ -1,22 +0,0 @@ -[Unit] -Description=Friendica daemon -After=network.target mariadb.service -Requires=network.target remote-fs.target nss-lookup.target - -[Service] -Type=simple -User=__APP__ -Group=__APP__ -WorkingDirectory=__INSTALL_DIR__/ -StandardOutput=append:/var/log/__APP__/__APP__.log -StandardError=inherit -ExecStart=/usr/bin/php__PHPVERSION__ __INSTALL_DIR__/bin/daemon.php start -ExecStop=/usr/bin/php__PHPVERSION__ __INSTALL_DIR__/bin/daemon.php stop -PIDFile=friendica/daemon.pid -PrivateTmp=true -InaccessibleDirectories=/home /root /boot /opt /mnt /media -ReadOnlyDirectories=/etc /usr -Restart=always - -[Install] -WantedBy=multi-user.target \ No newline at end of file diff --git a/scripts/backup b/scripts/backup index 63677f2..8dce025 100644 --- a/scripts/backup +++ b/scripts/backup @@ -52,7 +52,7 @@ ynh_backup --src_path="/etc/logrotate.d/$app" # BACKUP VARIOUS FILES #================================================= -ynh_backup --src_path="/etc/systemd/system/$app.service" +ynh_backup --src_path="/etc/cron.d/$app" #================================================= # BACKUP THE MYSQL DATABASE diff --git a/scripts/install b/scripts/install index 16d88ad..4b819e2 100644 --- a/scripts/install +++ b/scripts/install @@ -51,10 +51,9 @@ ynh_add_fpm_config --usage=low --footprint=low # Create a dedicated nginx config ynh_add_nginx_config -# Create a dedicated systemd config -ynh_add_systemd_config - -yunohost service add $app --description="Friendica daemon" --log="/var/log/$app/$app.log" +ynh_add_config --template="../conf/cron" --destination="/etc/cron.d/$app" +chown root: "/etc/cron.d/$app" +chmod 644 "/etc/cron.d/$app" # Use logrotate to manage application logfile(s) ynh_use_logrotate @@ -89,13 +88,6 @@ pushd "$install_dir" popd -#================================================= -# START SYSTEMD SERVICE -#================================================= -ynh_script_progression --message="Starting a systemd service..." --weight=1 - -ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/$app.log" - #================================================= # END OF SCRIPT #================================================= diff --git a/scripts/remove b/scripts/remove index 51eda02..6f01b8e 100644 --- a/scripts/remove +++ b/scripts/remove @@ -16,15 +16,6 @@ source /usr/share/yunohost/helpers #================================================= ynh_script_progression --message="Removing system configurations related to $app..." --weight=1 -# Remove the service from the list of services known by YunoHost (added from `yunohost service add`) -if ynh_exec_warn_less yunohost service status $app >/dev/null -then - ynh_script_progression --message="Removing $app service integration..." --weight=1 - yunohost service remove $app -fi - -ynh_remove_systemd_config - # Remove the dedicated nginx config ynh_remove_nginx_config diff --git a/scripts/restore b/scripts/restore index 7cdce78..648fa0a 100644 --- a/scripts/restore +++ b/scripts/restore @@ -38,17 +38,14 @@ ynh_restore_file --origin_path="/etc/php/$phpversion/fpm/pool.d/$app.conf" ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf" -ynh_restore_file --origin_path="/etc/systemd/system/$app.service" -systemctl enable $app.service --quiet - -yunohost service add $app --description="Friendica daemon" --log="/var/log/$app/$app.log" - ynh_restore_file --origin_path="/etc/logrotate.d/$app" ynh_restore_file --origin_path="/etc/fail2ban/jail.d/$app.conf" ynh_restore_file --origin_path="/etc/fail2ban/filter.d/$app.conf" ynh_systemd_action --action=restart --service_name=fail2ban +ynh_restore_file --origin_path="/etc/cron.d/$app" + #================================================= # GENERIC FINALIZATION #================================================= @@ -56,7 +53,6 @@ ynh_systemd_action --action=restart --service_name=fail2ban #================================================= ynh_script_progression --message="Reloading NGINX web server and $app's service..." --weight=1 -ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/$app.log" ynh_systemd_action --service_name=php$phpversion-fpm --action=reload ynh_systemd_action --service_name=nginx --action=reload