mirror of
https://github.com/AG7GN/nexus-utilities.git
synced 2025-05-15 22:20:09 -07:00
Update patmail.sh
This commit is contained in:
parent
8cc37f3d30
commit
cec333b746
19
patmail.sh
19
patmail.sh
@ -21,10 +21,12 @@
|
|||||||
#% If default location, will use mailbox in
|
#% If default location, will use mailbox in
|
||||||
#% $HOME/.local/pat/mailbox.
|
#% $HOME/.local/pat/mailbox.
|
||||||
#% -m, --mailbox=DIRECTORY Override mailbox location.
|
#% -m, --mailbox=DIRECTORY Override mailbox location.
|
||||||
#% Default: $HOME/.local/pat/mailbox
|
#% Default: $HOME/.local/share/pat/mailbox
|
||||||
#% -l FILE, --log=FILE Send pat diagnostic output to FILE. FILE will be
|
#% -l FILE, --log=FILE Send pat event log output to FILE. FILE will be
|
||||||
#% overwritten if it exists. To send output to stdout,
|
#% overwritten if it exists. To send output to stdout,
|
||||||
#% use /dev/stdout. Default: /dev/null
|
#% use /dev/stdout. Default: /dev/null
|
||||||
|
#% -o FILE, --olog=File Override pat log file.
|
||||||
|
#% Default: $HOME/.local/state/pat/pat.log
|
||||||
#% -f FILE, --file=FILE Attach file to message where file is full path to
|
#% -f FILE, --file=FILE Attach file to message where file is full path to
|
||||||
#% file. To attach multiple files, use multiple -f FILE
|
#% file. To attach multiple files, use multiple -f FILE
|
||||||
#% arguments, one per attached file.
|
#% arguments, one per attached file.
|
||||||
@ -78,7 +80,7 @@
|
|||||||
#%
|
#%
|
||||||
#================================================================
|
#================================================================
|
||||||
#- IMPLEMENTATION
|
#- IMPLEMENTATION
|
||||||
#- version ${SCRIPT_NAME} 2.5.2
|
#- version ${SCRIPT_NAME} 2.5.3
|
||||||
#- author Steve Magnuson, AG7GN
|
#- author Steve Magnuson, AG7GN
|
||||||
#- license CC-BY-SA Creative Commons License
|
#- license CC-BY-SA Creative Commons License
|
||||||
#- script_id 0
|
#- script_id 0
|
||||||
@ -170,7 +172,7 @@ VERSION="$(ScriptInfo version | grep version | tr -s ' ' | cut -d' ' -f 4)"
|
|||||||
#============================
|
#============================
|
||||||
|
|
||||||
#== set short options ==#
|
#== set short options ==#
|
||||||
SCRIPT_OPTS=':d:f:l:m:hv-:'
|
SCRIPT_OPTS=':d:f:l:m:o:hv-:'
|
||||||
|
|
||||||
#== set long options associated with short one ==#
|
#== set long options associated with short one ==#
|
||||||
typeset -A ARRAY_OPTS
|
typeset -A ARRAY_OPTS
|
||||||
@ -180,6 +182,7 @@ ARRAY_OPTS=(
|
|||||||
[dir]=d
|
[dir]=d
|
||||||
[file]=f
|
[file]=f
|
||||||
[log]=l
|
[log]=l
|
||||||
|
[olog]=o
|
||||||
[mailbox]=m
|
[mailbox]=m
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -243,6 +246,9 @@ do
|
|||||||
m)
|
m)
|
||||||
MBOX="$OPTARG"
|
MBOX="$OPTARG"
|
||||||
;;
|
;;
|
||||||
|
m)
|
||||||
|
LOG_FILE="$OPTARG"
|
||||||
|
;;
|
||||||
:)
|
:)
|
||||||
Die "${SCRIPT_NAME}: -$OPTARG: option requires an argument"
|
Die "${SCRIPT_NAME}: -$OPTARG: option requires an argument"
|
||||||
;;
|
;;
|
||||||
@ -293,9 +299,10 @@ then
|
|||||||
fi
|
fi
|
||||||
[[ -d "$PAT_DIR" ]] || Die "Directory $PAT_DIR does not exist or is not a directory."
|
[[ -d "$PAT_DIR" ]] || Die "Directory $PAT_DIR does not exist or is not a directory."
|
||||||
PAT_CONFIG="$PAT_DIR/config.json"
|
PAT_CONFIG="$PAT_DIR/config.json"
|
||||||
[[ -d $MBOX ]] || Die "Mailbox directory $MBOX does not exist or is not a directory."
|
[[ -d "$MBOX" ]] || Die "Mailbox directory $MBOX does not exist or is not a directory."
|
||||||
EVENT_LOG="${EVENT_LOG:-/dev/null}"
|
EVENT_LOG="${EVENT_LOG:-/dev/null}"
|
||||||
[[ -w $EVENT_LOG ]] || EVENT_LOG="/dev/null"
|
[[ -w "$EVENT_LOG" ]] || EVENT_LOG="/dev/null"
|
||||||
|
[[ -f "$LOG_FILE" ]] || touch "$LOG_FILE" || Die "Cannot write to log file $LOG_FILE"
|
||||||
|
|
||||||
CALL="$(cat $PAT_CONFIG | grep "\"mycall\":" | tr -d ' ",' | cut -d: -f2)"
|
CALL="$(cat $PAT_CONFIG | grep "\"mycall\":" | tr -d ' ",' | cut -d: -f2)"
|
||||||
[[ $CALL == "" ]] && Die "Could not obtain call sign from $PAT_CONFIG. Is pat configured?"
|
[[ $CALL == "" ]] && Die "Could not obtain call sign from $PAT_CONFIG. Is pat configured?"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user