save point
This commit is contained in:
parent
38f475d045
commit
89f514ce60
3 changed files with 18 additions and 4 deletions
|
@ -4,7 +4,7 @@ A framework for making bash scripts with some useful features
|
|||
|
||||
# The config scripts
|
||||
|
||||
One uses JQ the other awk,grep and sed. They basically achieve the same thing though to allow you to have a config file for a bash script. Good for keeping things like passwords and such out of the script itself. JQ is a external requirement that might need to be installed as to the where the others are likley already there. JQ runs on basically any platform, so its not a big issue. Even on my router so there is that.
|
||||
One uses JQ the other awk,grep and sed. They basically achieve the same thing though to allow you to have a config file for a bash script. Good for keeping things like passwords and such out of the script itself. JQ is a external requirement that might need to be installed as to the where the others are likley already there. JQ runs on basically any platform, so its not a big issue. Even on my router so there is that. These alone have no end of uses. Great for seperating out user names and passwords from code. I like to json and add config.json into .gitignore for any projects I open source using bash. Very useful.
|
||||
|
||||
# Where did the name come from?
|
||||
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
#!/bin/bash
|
||||
|
||||
# was split out to a seperate project, but will be pulled in when done
|
||||
|
||||
# check for curl
|
||||
|
||||
if ! command -v curl &> /dev/null
|
||||
|
|
18
sys.bash
18
sys.bash
|
@ -1,5 +1,5 @@
|
|||
#!/bin/bash
|
||||
set -x
|
||||
#set -x
|
||||
# a bash file that can provide various bits of info about the system
|
||||
|
||||
function cpuinfo() {
|
||||
|
@ -26,11 +26,23 @@ function diskinfo() {
|
|||
|
||||
function networkinfo() {
|
||||
echo "Network:"
|
||||
# We will get to this later
|
||||
# get network interfaces and usage
|
||||
|
||||
# get network adapters and usage
|
||||
adapters=$(ip -s addr | grep -E '^[0-9]:' | awk -F ':' '{print $2}')
|
||||
for adapter in $adapters; do
|
||||
rx=$(ip -s link show $adapter | awk '/RX:/ {print $2}')
|
||||
tx=$(ip -s link show $adapter | awk '/TX:/ {print $2}')
|
||||
echo -e "$adapter\tRX: $rx\tTX: $tx"
|
||||
done
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
# This seems to be a good layout for sys.bash for now
|
||||
|
||||
cpuinfo
|
||||
meminfo
|
||||
meminfo
|
||||
diskinfo
|
||||
networkinfo
|
Loading…
Add table
Add a link
Reference in a new issue