at 24.11-pre 64 lines 2.5 kB view raw
1diff --git a/scripts/msmtpq/msmtpq b/scripts/msmtpq/msmtpq 2index d8b4039..1f2a7b5 100755 3--- a/scripts/msmtpq/msmtpq 4+++ b/scripts/msmtpq/msmtpq 5@@ -60,8 +60,8 @@ err() { dsp '' "$@" '' ; exit 1 ; } 6 ## e.g. ( export MSMTP=/path/to/msmtp ) 7 if [ "$MSMTP" = "" ] ; then # If MSMTP is unset or empty... 8 MSMTP=msmtp 9-elif [ ! -x "$MSMTP" ] ; then 10- log -e 1 "msmtpq : can't find the msmtp executable [ $MSMTP ]" # if not found - complain ; quit 11+# elif [ ! -x "$MSMTP" ] ; then 12+# log -e 1 "msmtpq : can't find the msmtp executable [ $MSMTP ]" # if not found - complain ; quit 13 fi 14 ## 15 ## set the queue var to the location of the msmtp queue directory 16@@ -71,7 +71,7 @@ fi 17 ## ( chmod 0700 msmtp.queue ) 18 ## 19 ## the queue dir - export this variable to reflect where you'd like it to be (no quotes !!) 20-Q=${Q:-~/.msmtp.queue} 21+Q=${MSMTP_QUEUE:-~/.msmtp.queue} 22 [ -d "$Q" ] || mkdir -m 0700 -p "$Q" || \ 23 err '' "msmtpq : can't find or create msmtp queue directory [ $Q ]" '' # if not present - complain ; quit 24 ## 25@@ -85,8 +85,10 @@ Q=${Q:-~/.msmtp.queue} 26 ## 27 ## the queue log file - export this variable to change where logs are stored (but no quotes !!) 28 ## Set it to "" (empty string) to disable logging. 29-[ -v LOG ] || LOG=~/log/msmtp.queue.log 30+LOG=${MSMTP_LOG:-~/log/msmtp.queue.log} 31 [ -d "$(dirname "$LOG")" ] || mkdir -p "$(dirname "$LOG")" 32+ 33+JOURNAL=@journal@ 34 ## ====================================================================================== 35 36 ## msmtpq can use the following environment variables : 37@@ -139,6 +141,7 @@ on_exit() { # unlock the queue on exit if the lock was 38 ## display msg to user, as well 39 ## 40 log() { 41+ local NAME=msmtpq 42 local ARG RC PFX 43 PFX="$('date' +'%Y %d %b %H:%M:%S')" 44 # time stamp prefix - "2008 13 Mar 03:59:45 " 45@@ -156,10 +159,19 @@ log() { 46 done 47 fi 48 49+ if [ "$JOURNAL" = "Y" ]; then 50+ for ARG; do 51+ [ -n "$ARG" ] && 52+ echo "$ARG" | systemd-cat -t "$NAME" -p info 53+ done 54+ fi 55+ 56 if [ -n "$RC" ] ; then # an error ; leave w/error return 57 [ -n "$LKD" ] && lock_queue -u # unlock here (if locked) 58 [ -n "$LOG" ] && \ 59 echo " exit code = $RC" >> "$LOG" # logging ok ; send exit code to log 60+ [ "$JOURNAL" = "Y" ] && \ 61+ echo "exit code= $RC" | systemd-cat -t "$NAME" -p emerg 62 exit "$RC" # exit w/return code 63 fi 64 }