diff --git a/data/helpers.d/system b/data/helpers.d/system index 24e89dccb..71db85390 100644 --- a/data/helpers.d/system +++ b/data/helpers.d/system @@ -89,14 +89,14 @@ ynh_systemd_action() { if [[ -n "${line_match:-}" ]] then local templog="$(mktemp)" - # Following the starting of the app in its log - if [ "$log_path" == "systemd" ] ; then + # Following the starting of the app in its log + if [ "$log_path" == "systemd" ] ; then # Read the systemd journal journalctl --unit=$service_name --follow --since=-0 --quiet > "$templog" & - else + else # Read the specified log file tail -F -n0 "$log_path" > "$templog" & - fi + fi # Get the PID of the tail command local pid_tail=$! fi @@ -104,7 +104,7 @@ ynh_systemd_action() { echo "${action^} the service $service_name" >&2 systemctl $action $service_name \ || ( journalctl --lines=$length -u $service_name >&2 \ - ; test -n "$log_path" && echo "--" && tail --lines=$length "$log_path" >&2 \ + ; test -e "$log_path" && echo "--" && tail --lines=$length "$log_path" >&2 \ ; false ) # Start the timeout and try to find line_match @@ -127,7 +127,7 @@ ynh_systemd_action() { echo "The service $service_name didn't fully started before the timeout." >&2 echo "Please find here an extract of the end of the log of the service $service_name:" journalctl --lines=$length -u $service_name >&2 - test -n "$log_path" && echo "--" && tail --lines=$length "$log_path" >&2 + test -e "$log_path" && echo "--" && tail --lines=$length "$log_path" >&2 fi echo ""