at 18.03-beta 96 lines 3.8 kB view raw
1diff --git a/scripts/msmtpq/msmtp-queue b/scripts/msmtpq/msmtp-queue 2index 1dc220d..d834241 100755 3--- a/scripts/msmtpq/msmtp-queue 4+++ b/scripts/msmtpq/msmtp-queue 5@@ -27,4 +27,4 @@ 6 ## change the below line to be 7 ## exec /path/to/msmtpq --q-mgmt 8 9-exec msmtpq --q-mgmt "$1" 10+exec @msmtpq@ --q-mgmt "$1" 11diff --git a/scripts/msmtpq/msmtpq b/scripts/msmtpq/msmtpq 12index bdb4fb8..1363a67 100755 13--- a/scripts/msmtpq/msmtpq 14+++ b/scripts/msmtpq/msmtpq 15@@ -59,7 +59,7 @@ err() { dsp '' "$@" '' ; exit 1 ; } 16 ## enter the location of the msmtp executable (no quotes !!) 17 ## e.g. ( MSMTP=/path/to/msmtp ) 18 ## and uncomment the test for its existence 19-MSMTP=msmtp 20+MSMTP=@msmtp@ 21 #[ -x "$MSMTP" ] || \ 22 # log -e 1 "msmtpq : can't find the msmtp executable [ $MSMTP ]" # if not found - complain ; quit 23 ## 24@@ -70,9 +70,8 @@ MSMTP=msmtp 25 ## ( chmod 0700 msmtp.queue ) 26 ## 27 ## the queue dir - modify this to reflect where you'd like it to be (no quotes !!) 28-Q=~/.msmtp.queue 29-[ -d "$Q" ] || \ 30- err '' "msmtpq : can't find msmtp queue directory [ $Q ]" '' # if not present - complain ; quit 31+Q=${MSMTP_QUEUE:-~/.msmtp.queue} 32+test -d "$Q" || mkdir -p "$Q" 33 ## 34 ## set the queue log file var to the location of the msmtp queue log file 35 ## where it is or where you'd like it to be 36@@ -84,7 +83,10 @@ Q=~/.msmtp.queue 37 ## (doing so would be inadvisable under most conditions, however) 38 ## 39 ## the queue log file - modify (or comment out) to taste (but no quotes !!) 40-LOG=~/log/msmtp.queue.log 41+LOG=${MSMTP_LOG:-~/log/msmtp.queue.log} 42+test -d "$(dirname $LOG)" || mkdir -p "$(dirname $LOG)" 43+ 44+JOURNAL=@journal@ 45 ## ====================================================================================== 46 47 ## msmtpq can use the following environment variables : 48@@ -108,7 +110,7 @@ LOG=~/log/msmtp.queue.log 49 ## 50 #EMAIL_CONN_NOTEST=y # deprecated ; use below var 51 #EMAIL_CONN_TEST={x| |p|P|n|s} # see settings above for EMAIL_CONN_TEST 52-EMAIL_CONN_TEST=n 53+EMAIL_CONN_TEST=@test@ 54 #EMAIL_QUEUE_QUIET=t 55 ## ====================================================================================== 56 57@@ -138,6 +140,7 @@ on_exit() { # unlock the queue on exit if the lock was 58 ## display msg to user, as well 59 ## 60 log() { 61+ local NAME=msmtpq 62 local ARG RC PFX="$('date' +'%Y %d %b %H:%M:%S')" 63 # time stamp prefix - "2008 13 Mar 03:59:45 " 64 if [ "$1" = '-e' ] ; then # there's an error exit code 65@@ -154,10 +157,19 @@ log() { 66 done 67 fi 68 69+ if [ "$JOURNAL" == "y" ] ; then 70+ for ARG ; do 71+ [ -n "$ARG" ] && \ 72+ echo "$PFX : $ARG" | @systemdcat@ -t $NAME -p info 73+ done 74+ fi 75+ 76 if [ -n "$RC" ] ; then # an error ; leave w/error return 77 [ -n "$LKD" ] && lock_queue -u # unlock here (if locked) 78 [ -n "$LOG" ] && \ 79 echo " exit code = $RC" >> "$LOG" # logging ok ; send exit code to log 80+ [ "$JOURNAL" == "y" ] && \ 81+ echo "exit code= $RC" | @systemdcat@ -t $NAME -p emerg 82 exit $RC # exit w/return code 83 fi 84 } 85@@ -207,10 +219,7 @@ connect_test() { 86 ping -qnc1 -w4 8.8.8.8 >/dev/null 2>&1 || return 1 87 88 elif [ "$EMAIL_CONN_TEST" = 'n' ] ; then # use netcat (nc) test 89- # must, of course, have netcat (nc) installed 90- which nc >/dev/null 2>&1 || \ 91- log -e 1 "msmtpq : can't find netcat executable [ nc ]" # if not found - complain ; quit 92- 'nc' -vz www.debian.org 80 >/dev/null 2>&1 || return 1 93+ @nc@ -vz www.debian.org 80 >/dev/null 2>&1 || return 1 94 95 elif [ "$EMAIL_CONN_TEST" = 's' ] ; then # use sh sockets test 96 # note that this does not work on debian systems