mms-check script
This commit is contained in:
parent
afef2e3591
commit
b3dbe43239
38
change-username.sh
Executable file
38
change-username.sh
Executable file
|
@ -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
Executable file
21
mms-check
Executable file
|
@ -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…
Reference in New Issue
Block a user