diff --git a/conf/systemd.service b/conf/systemd.service index 73d0628..33ff720 100644 --- a/conf/systemd.service +++ b/conf/systemd.service @@ -8,6 +8,8 @@ User=__APP__ Group=__APP__ WorkingDirectory=__FINALPATH__/ ExecStart=/bin/bash __FINALPATH__/dockerless-run.sh +StandardOutput=append:/var/log/__APP__/__APP__.log +StandardError=inherit # Sandboxing options to harden security # Depending on specificities of your service/app, you may need to tweak these diff --git a/scripts/install b/scripts/install index d2f357e..4be76a6 100755 --- a/scripts/install +++ b/scripts/install @@ -109,6 +109,20 @@ chmod 750 "$final_path" chmod -R o-rwx "$final_path" chown -R $app:www-data "$final_path" +#================================================= +# CREATE LOG FILE +#================================================= +ynh_script_progression --message="Creating log file..." --weight=1 + +mkdir -p "/var/log/$app/" +touch "/var/log/$app/${app}.log" +chown -R $app: "/var/log/$app/" + +#================================================= +# SCRIPT AND DEP INIT +#================================================= +ynh_script_progression --message="Installing service script..." --weight=1 + ynh_add_config --template="dockerless-run.sh" --destination="$final_path/dockerless-run.sh" chmod 700 "$final_path/dockerless-run.sh" chown $app:$app "$final_path/dockerless-run.sh"