From f355a33b44be5b07e24b0bcb0f6629c691279f00 Mon Sep 17 00:00:00 2001 From: Jeremy KQ4AFY Bouse Date: Fri, 23 Dec 2022 13:49:41 -0500 Subject: [PATCH] MovetoPat has wrong mailbox path #8 * Makes use of `pat env` environment variables * Code indention for readability Signed-off-by: Jeremy KQ4AFY Bouse --- movetopat | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/movetopat b/movetopat index 4a6a3a1..ba60258 100644 --- a/movetopat +++ b/movetopat @@ -7,28 +7,23 @@ #20180406 km4ack #20190106 edited by kf7itf #20211203 edited by KM4ACK +#20221223 edited by KQ4AFY #script should be run by cron every #minute. -CONFIG=/home/pi/.config/pat/config.json - -#sets the MYCALL variable by reading the info from ~/.wl2k/config.json file for the configured operator. -MYCALL=$(awk '/"mycall": "/{print}' $CONFIG |grep -o -P '(?<=mycall": ").*(?=",)' | tr '[:lower:]' '[:upper:]') +# sets environment variables from pat +eval $(pat env) CHECK=$(ls /var/www/html/emails/) #check if files are in directory if [ -z "$CHECK" ] then -#exit if files not found -exit 0 + #exit if files not found + exit 0 else -#move the files if found -sudo mv /var/www/html/emails/*.b2f $HOME/.local/share/pat/mailbox/$MYCALL/out + #move the files if found + sudo mv /var/www/html/emails/*.b2f ${PAT_MAILBOX_PATH}/${PAT_MYCALL}/out/ fi - - - - exit 0