From 22e2b97fa2fca3ed1003902331be7abcc49fd109 Mon Sep 17 00:00:00 2001 From: olf Date: Sun, 2 Apr 2023 03:08:50 +0200 Subject: [PATCH] Slightly improve preamble: logfile --- bin/sailfishos-chum-gui-installer | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/bin/sailfishos-chum-gui-installer b/bin/sailfishos-chum-gui-installer index 952064b..89992c7 100644 --- a/bin/sailfishos-chum-gui-installer +++ b/bin/sailfishos-chum-gui-installer @@ -53,15 +53,14 @@ logfile="$2" umask 113 [ "$PWD" = / ] || cd / # Set PWD to /, if not already -# Prefix first output with one plus two linebreaks, if logfile size > 0 -linebreaks='' +# Prefix first output with a linebreak, dashes and another linebreak, if logfile size > 0 if [ -s "$logfile" ] -then linebreaks='\n-----------------------------\n\n' +then printf '\n%s\n\n' "-----------------------------" fi # Write first entry to logfile: -logentry="[Info] PID $mypid is logging to $logfile" -if printf "${linebreaks}%s\n" "$(date -Iseconds) $logentry" +logentry="[Info] PID $mypid is logging to $logfile on" +if printf '%s %s\n' "$logentry" "$(date -Iseconds)" then systemd-cat -t "$called" -p 6 printf '%s\n' "$logentry" else systemd-cat -t "$called" -p 4 printf '%s\n' "[Warning] PID $mypid failed to write to $logfile" fi