diff --git a/scripts/modem/sxmo_modemmonitor.sh b/scripts/modem/sxmo_modemmonitor.sh index 21d663f..4707631 100755 --- a/scripts/modem/sxmo_modemmonitor.sh +++ b/scripts/modem/sxmo_modemmonitor.sh @@ -40,7 +40,7 @@ checkformissedcalls() { grep -oE "Call\/[0-9]+" | cut -d'/' -f2 ); do - MISSEDNUMBER="$(lookupnumberfromcallid $MISSEDCALLID)" + MISSEDNUMBER="$(lookupnumberfromcallid "$MISSEDCALLID")" mmcli -m "$(modem_n)" --voice-delete-call "$MISSEDCALLID" TIME="$(date --iso-8601=seconds)" @@ -48,7 +48,6 @@ checkformissedcalls() { printf %b "$TIME\tcall_missed\t$MISSEDNUMBER\n" >> "$LOGDIR/modemlog.tsv" CONTACT="$(sxmo_contacts.sh | grep -E "^$MISSEDNUMBER")" - RUNCOMMAND="" sxmo_notificationwrite.sh \ random \ "st -f Terminus-20 -e sh -c \"echo 'Missed call from $CONTACT at $(date)' && read\"" \ diff --git a/scripts/notifications/sxmo_notificationmonitor.sh b/scripts/notifications/sxmo_notificationmonitor.sh index fa211e3..11d2a36 100755 --- a/scripts/notifications/sxmo_notificationmonitor.sh +++ b/scripts/notifications/sxmo_notificationmonitor.sh @@ -54,19 +54,20 @@ recreateexistingnotifs() { monitorforaddordelnotifs() { while true; do - [ $(find "$NOTIFDIR"/ -type f | wc -l) -lt 1 ] && sxmo_setpineled green 0 + [ "$(find "$NOTIFDIR"/ -type f | wc -l)" -lt 1 ] && sxmo_setpineled green 0 inotifywait -e create,attrib,moved_to,delete,delete_self,moved_from "$NOTIFDIR"/ | ( INOTIFYOUTPUT="$(cat)" INOTIFYEVENTTYPE="$(echo "$INOTIFYOUTPUT" | cut -d" " -f2)" - echo "$INOTIFYEVENTTYPE" | grep -E "CREATE|MOVED_TO|ATTRIB" || continue - NOTIFFILE="$NOTIFDIR/$(echo "$INOTIFYOUTPUT" | cut -d" " -f3)" - handlenewnotiffile "$NOTIFFILE" + if echo "$INOTIFYEVENTTYPE" | grep -E "CREATE|MOVED_TO|ATTRIB"; then + NOTIFFILE="$NOTIFDIR/$(echo "$INOTIFYOUTPUT" | cut -d" " -f3)" + handlenewnotiffile "$NOTIFFILE" + fi ) & wait done } pgrep -f "$(command -v sxmo_notificationmonitor.sh)" | grep -Ev "^${$}$" | xargs kill -rm -f $NOTIFDIR/incomingcall +rm -f "$NOTIFDIR"/incomingcall recreateexistingnotifs monitorforaddordelnotifs