Browse Source

mms-check script

master
Noah Petherbridge 8 months ago
parent
commit
b3dbe43239
  1. 38
      change-username.sh
  2. 21
      mms-check

38
change-username.sh

@ -0,0 +1,38 @@
#!/bin/bash
# A script to change the current username
# Get current username
printf "\nType the current username:\n"
read old
# Set desired username
printf "\nType the desired username:\n"
read new
# Home paths
ohp="home/$old"
nhp="home/$new"
# Change username
printf "\nChanging username\n"
for file in group gshadow passwd shadow subgid subuid
do
sed -i "s/$old/$new/g" /etc/$file*
done
# Rename home folder
mv /$ohp /$nhp
# Fix path references in /home for new user
printf "\nAdjusting paths in home directory\n"
grep -rl "$ohp" /$nhp | xargs sed -i "s+$ohp+$nhp+g"
# Set user info
echo
chfn $new
sync
reboot

21
mms-check

@ -0,0 +1,21 @@
#!/usr/bin/perl
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;
}
Loading…
Cancel
Save