31 lines
832 B
Perl
Executable File
31 lines
832 B
Perl
Executable File
#!/usr/bin/perl
|
|
|
|
# Check ModemManager for pending SMS/MMS messages clogging its queue.
|
|
# Until mobile Linux natively supports MMS messages, ModemManager is
|
|
# needed along with Janky MMS (https://git.sr.ht/~amindfv/jmms) to get
|
|
# your messages and flush the queue; if the queue gets clogged you don't
|
|
# get incoming messages anymore.
|
|
|
|
# Usage: run this in your .bashrc so it'll print in your new terminal
|
|
# session to remind you that messages are pending.
|
|
|
|
use 5.12.0;
|
|
use strict;
|
|
use warnings;
|
|
|
|
# Find modem ID
|
|
my $modem;
|
|
my $list = `mmcli -L`;
|
|
if ($list =~ m{/Modem/(\d+)}i) {
|
|
$modem = $1;
|
|
} else {
|
|
die "didn't find modem id";
|
|
}
|
|
|
|
my $chk = `mmcli -m $modem --messaging-list-sms`;
|
|
my @lines = split(/\n/, $chk);
|
|
if ($chk !~ /no sms messages were found/i) {
|
|
say "Notice: mmcli shows there are pending SMS messages:";
|
|
say $chk;
|
|
}
|