-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
93 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
#!/usr/bin/env bash | ||
ARG=$1 | ||
|
||
_TZ=UTC | ||
if [ -z "$ARG" ];then | ||
ARG=$_TZ | ||
else | ||
_TZ=$ARG | ||
# A selection of deprecated zone aliases, we translate these to current TZ syntax | ||
ZoneAlias=("CET" "Europe/Paris" "IST" "Asia/Kolkata" "EST" "America/Cancun" "EST5EDT" "America/New_York" "PRC" "Asia/Shanghai" "ROC" "Asia/Taipei" "ROK" "Asia/Seoul") | ||
size=${#ZoneAlias[@]} | ||
for ((i=0; i < size; i++,i++)); do | ||
[ "$ARG" == "${ZoneAlias[$i]}" ] && _TZ="${ZoneAlias[$i+1]}" | ||
done | ||
fi | ||
|
||
# This is a normal comment. This will not be displayed in the help. | ||
# When transmitting scripts through ssh-batch, all comments are skipped, so you do not waste bandwidth. | ||
|
||
# Print out the Linux reported timezone | ||
CTZ=$(TZ=${_TZ} date +%Z) | ||
# Here we try a who -b, but if you have an older Linux, the -b option does not exist. In that case | ||
# Try uptime -s | ||
echo $((TZ=${_TZ} who -b||TZ=${_TZ} uptime -s) | sed -e 's/^[[:space:]]*//') $CTZ | ||
# Help can be added in any position of the script. In this case, I put it almost at the end. | ||
#: Show the Linux boot time in the selected timezone. | ||
#: The default TimeZone is <B>UTC, which you can change with a <B>parameter. | ||
#+: you can select from the following deprecated timezones: | ||
#+: <B>CET <B>IST <B>EST <B>EST5EDT <B>PRC <B>ROC <B>ROK | ||
#+: Note: During CEST, CET will mean CEST. | ||
#+: <Y>Example: <L>./evidencer <L>os.show.boottime=# <L>-- <L>CET | ||
#+: <Y>Example: <L>./evidencer <L>os.show.boottime=# <L>-- <L>Europe/Lisbon | ||
#+: <C>See: <A>https://en.wikipedia.org/wiki/List_of_tz_database_time_zones | ||
#+: So instead of <B>WET you need to use <B>Europe/Lisbon (although WET still works) | ||
# Throw in a bit of reboot history, for good measure: | ||
TZ=$_TZ last reboot |head -4 | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
#!/usr/bin/env bash | ||
|
||
lscpu | grep -e "^CPU(s):" | cut -f2 -d: | awk '{print $1}' | ||
#: Display the number of CPU's a (virtual)machine has. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
#!/usr/bin/env bash | ||
ARG=$1 | ||
|
||
if [ -z "$ARG" ];then | ||
free -h | ||
else | ||
free $@ | ||
fi | ||
|
||
#: Show the Linux Memory Usage. | ||
#: The default is <B>-h, Human readable format, which you can change with a parameter. | ||
#=: See the manual for <B>free for all the options. Some options are: | ||
#+: <B>-b<:>, <B>--bytes Display the amount of memory in bytes. | ||
#+: <B>-k<:>, <B>--kibi Display the amount of memory in kibibytes. (official default) | ||
#+: <B>-g<:>, <B>--gibi Display the amount of memory in gibibytes. | ||
#+: <B>--giga Display the amount of memory in gigabytes. | ||
#=: These two expressions are the same: | ||
#=: <Y>Example: <L:>./evidencer <0> -- -b<:> | ||
#+: <Y>Example: <L:>./evidencer <0> -a -b<:> | ||
#=: These two expressions are the same: | ||
#=: <Y>Example: <L:>./evidencer <0> -- -k -w<:> | ||
#+: <Y>Example: <L:>./evidencer <0> -a '-k -w'<:> | ||
#+: <Y>Example: <L:>./evidencer <0> -a -k -a -w<:> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#!/usr/bin/env bash | ||
ARG=$1 | ||
echo "ARG($ARG)" | ||
PREALLOCATED=350000 | ||
if [ ! -z "$ARG" ];then | ||
PREALLOCATED=$ARG | ||
fi | ||
|
||
echo "PREALLOCATED=$PREALLOCATED" | ||
cat /proc/meminfo |grep MemTotal: | ||
cat /proc/meminfo |grep MemTotal:|awk '{print $2}' |xargs -I{} echo "scale=1; ({}+$PREALLOCATED) / 1024/1024" |bc | ||
|
||
#: Show the Linux Total amount of Memory. | ||
#+: We've assumed that 350k of address space is snooped off by perifericals and BIOS/UEFI. | ||
#+: You can override that value with a parameter | ||
#=: <Y>Example: <L:>./evidencer <0> | ||
#+: <Y>Example: <L:>./evidencer <0> -a 315000<:> | ||
|
||
# https://serverfault.com/questions/1040981/how-much-physical-ram-is-lost-to-bios-uefi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
#!/usr/bin/env bash | ||
uptime $@ | ||
|
||
#: Show the Linux uptime. Allows parameters. | ||
#=: <Y>Example: <L:>./evidencer <0> -- -p<:> | ||
#=: Shows only the update in human readable format. |