Use printers

This commit is contained in:
Maniack Crudelis 2019-03-03 16:38:54 +01:00 committed by GitHub
parent f51101152a
commit 12c61eeb65
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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
}