From 3f3fec6d1c7765f69c58f54a23489e1602780f0b Mon Sep 17 00:00:00 2001 From: yalh76 Date: Sat, 2 Feb 2019 00:33:27 +0100 Subject: [PATCH] Fix Service logs --- conf/systemd.service | 2 +- scripts/install | 10 +++++++++- scripts/restore | 8 ++++++++ 3 files changed, 18 insertions(+), 2 deletions(-) diff --git a/conf/systemd.service b/conf/systemd.service index 35c2d16..eb1c958 100644 --- a/conf/systemd.service +++ b/conf/systemd.service @@ -7,7 +7,7 @@ Type=simple User=__APP__ Group=__APP__ WorkingDirectory=__FINALPATH__/ -ExecStart=__NODEJS_PATH__/node __FINALPATH__/server >> /var/log/__APP__/__APP__.log 2>&1 +ExecStart=/bin/sh -c '__NODEJS_PATH__/node __FINALPATH__/server >> /var/log/__APP__/__APP__.log 2>&1' [Install] WantedBy=multi-user.target diff --git a/scripts/install b/scripts/install index ab0b3f5..3eb34c6 100644 --- a/scripts/install +++ b/scripts/install @@ -170,9 +170,17 @@ ynh_system_user_create "$app" "$final_path" #================================================= # SPECIFIC SETUP #================================================= -# ... +# CREATE LOG FOLDER #================================================= +mkdir -p "/var/log/$app" +chown -R "$app":"$app" "/var/log/$app" + +#================================================= +# MAKE SETUP +#================================================= + + chown -R "$app":"$app" "$final_path" pushd $final_path diff --git a/scripts/restore b/scripts/restore index 0005bb5..4151059 100644 --- a/scripts/restore +++ b/scripts/restore @@ -101,6 +101,7 @@ ynh_install_nodejs 10 ynh_restore_file "/etc/systemd/system/$app.service" systemctl enable $app.service +systemctl daemon-reload #================================================= # ADVERTISE SERVICE IN ADMIN PANEL @@ -129,6 +130,13 @@ ynh_restore_file "/etc/logrotate.d/$app" #systemctl reload php5-fpm systemctl reload nginx +#================================================= +# CREATE LOG FOLDER +#================================================= + +mkdir -p "/var/log/$app" +chown -R "$app":"$app" "/var/log/$app" + #================================================= # START SERVICE #=================================================