From a0a119efc467b1bcf7ed8f16702489e2627d38f8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Wed, 1 Nov 2023 10:04:58 +0100 Subject: [PATCH] fix --- conf/rustdesk-hbbs.service | 5 ++--- conf/rustdesk-server.service | 5 ++--- scripts/install | 12 ++++++++++++ 3 files changed, 16 insertions(+), 6 deletions(-) diff --git a/conf/rustdesk-hbbs.service b/conf/rustdesk-hbbs.service index 77f7252..3d95241 100644 --- a/conf/rustdesk-hbbs.service +++ b/conf/rustdesk-hbbs.service @@ -9,9 +9,8 @@ Restart=always LimitNOFILE=1000000 WorkingDirectory=__INSTALL_DIR__/ ExecStart=__INSTALL_DIR__/hbbs -r 127.0.0.1 -p __PORT_HBBS__ -#StandardOutput=append:__INSTALL_DIR__/hbbs.log -#StandardError=append:__INSTALL_DIR__/hbbs.error -# Restart service after 10 seconds if node service crashes +StandardOutput=append:/var/log/__APP__/hbbs.log +StandardError=append:/var/log/__APP__/hbbs.error RestartSec=10 [Install] diff --git a/conf/rustdesk-server.service b/conf/rustdesk-server.service index d5605c2..889f48c 100644 --- a/conf/rustdesk-server.service +++ b/conf/rustdesk-server.service @@ -9,9 +9,8 @@ LimitNOFILE=1000000 ExecStart=__INSTALL_DIR__/hbbr -p __PORT_HBBR__ WorkingDirectory=__INSTALL_DIR__/ Restart=always -#StandardOutput=append:rustdesk-server/hbbr.log -#StandardError=append:rustdesk-server/hbbr.error -# Restart service after 10 seconds if node service crashes +StandardOutput=append:/var/log/__APP__/hbbr.log +StandardError=append:/var/log/__APP__/hbbr.error RestartSec=10 [Install] diff --git a/scripts/install b/scripts/install index 5ce2b8b..835aecb 100755 --- a/scripts/install +++ b/scripts/install @@ -38,6 +38,18 @@ ynh_add_systemd_config --service=rustdesk-hbbs --template=rustdesk-hbbs.service yunohost service add rustdesk-server --description="Remote control alternative for self-hosting" --log="/var/log/$app/$app.log" yunohost service add rustdesk-hbbs --description="Remote control alternative for self-hosting" --log="/var/log/$app/$app.log" +# HANDLE LOG FILES AND LOGROTATE +#================================================= +ynh_script_progression --message="Configuring log rotation..." --weight=1 + +# Create log directory +mkdir -p /var/log/$app +touch /var/log/$app/$app.log +chown $app -R /var/log/$app + +# Use logrotate to manage application logfile(s) +ynh_use_logrotate + #================================================= # APP INITIAL CONFIGURATION #=================================================