From 12c61eeb6507faddf902a0bdc9a7c13fbba2fdbe Mon Sep 17 00:00:00 2001 From: Maniack Crudelis Date: Sun, 3 Mar 2019 16:38:54 +0100 Subject: [PATCH] Use printers --- data/helpers.d/system | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/data/helpers.d/system b/data/helpers.d/system index cc1dbbcc5..f319f3f7b 100644 --- a/data/helpers.d/system +++ b/data/helpers.d/system @@ -106,10 +106,10 @@ ynh_systemd_action() { fi fi - echo "${action^} the service $service_name" >&2 + ynh_print_info --message="${action^} the service $service_name" systemctl $action $service_name \ || ( journalctl --no-pager --lines=$length -u $service_name >&2 \ - ; test -e "$log_path" && echo "--" && tail --lines=$length "$log_path" >&2 \ + ; test -e "$log_path" && echo "--" >&2 && tail --lines=$length "$log_path" >&2 \ ; false ) # Start the timeout and try to find line_match @@ -121,21 +121,20 @@ ynh_systemd_action() { # Read the log until the sentence is found, that means the app finished to start. Or run until the timeout if grep --quiet "$line_match" "$templog" then - echo "The service $service_name has correctly started." >&2 + ynh_print_info --message="The service $service_name has correctly started." break fi echo -n "." >&2 sleep 1 done + echo "" >&2 if [ $i -eq $timeout ] then - 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:" + ynh_print_warn --message="The service $service_name didn't fully started before the timeout." + ynh_print_warn --message="Please find here an extract of the end of the log of the service $service_name:" journalctl --no-pager --lines=$length -u $service_name >&2 - test -e "$log_path" && echo "--" && tail --lines=$length "$log_path" >&2 + test -e "$log_path" && echo "--" >&2 && tail --lines=$length "$log_path" >&2 fi - - echo "" ynh_clean_check_starting fi }