Update .bash_aliases, .nanorc, and 15 more files...
This commit is contained in:
parent
3db08fc6a5
commit
e42aa0ffe6
|
@ -0,0 +1,7 @@
|
|||
# bash
|
||||
#
|
||||
#
|
||||
# List of Aliases ls
|
||||
alias l='ls -CF'
|
||||
alias a='ls -al'
|
||||
alias='lsa -alCF'
|
125
init.sh
125
init.sh
|
@ -1,6 +1,13 @@
|
|||
#!/bin/sh
|
||||
#
|
||||
#!/bin/bash
|
||||
#
|
||||
# Repo Location that contains all the scripts to run
|
||||
REPO="https://scm.genesisrage.net/mrjohndowe/Raspi-Config/raw/branch/master/"
|
||||
DOWEFILES=".doweFiles/"
|
||||
|
||||
# Location to save the scripts
|
||||
SCRIPTS_PATH="/usr/local/bin/"
|
||||
|
||||
# Colors
|
||||
Color_Off='\033[0m' # Reset
|
||||
|
||||
# Regular Colors
|
||||
|
@ -20,34 +27,104 @@ phpVersion="8.0"
|
|||
mysql="mysql_install.sh"
|
||||
nginx="nginx_install.sh"
|
||||
phpmyadmin="phpmyadmin_installation.sh"
|
||||
# Temp Location Folder
|
||||
TEMP="/var/tmp/"
|
||||
|
||||
|
||||
###### END VARIABLES ######
|
||||
|
||||
sudo clear;
|
||||
echo "Welcome to the Dowe Server Files Installation....";
|
||||
echo "Please enter the name of the file you would like to install";
|
||||
echo -n "Options are: [1] NGINX, [2] MySql, [3] SQLite3, [4] PHPMyAdmin, [5] Gittea, [0] Install All | ";
|
||||
# BASH PROFILE
|
||||
#############
|
||||
# Copy the bashrc, profile, and bash_aliases file from the repository
|
||||
bash_copy(){
|
||||
curl -s ${REPO}.bashrc > ~/.bashrc
|
||||
curl -s ${REPO}.bash_aliases > ~/.bash_aliases
|
||||
curl -s ${REPO}.nanorc > ~/.nanorc
|
||||
curl -s ${REPO}.profile > ~/.profile
|
||||
|
||||
}
|
||||
|
||||
read OPTION;
|
||||
# MOTD SETUP
|
||||
############
|
||||
motd() {
|
||||
read -p " Would you like to setup MOTD? (Y/n) " -n 1 -r
|
||||
echo
|
||||
if [[ $REPLY =~ ^[yY]$ ]]
|
||||
then
|
||||
# Download the MOTD Files
|
||||
sudo wget ${REPO}${doweFiles}/motd.sh -O /etc/profile.d/motd.sh
|
||||
# Change Ownership of the file
|
||||
sudo chown root:root /etc/profile.d/motd.sh
|
||||
# Set the correct permissions
|
||||
sudo chmod +x /etc/profile.d/motd.sh
|
||||
# Create a backup of the Default MOTD
|
||||
sudo mv /etc/motd /etc/motd.BACKUP
|
||||
|
||||
elif [[ ! $REPLY =~ ^[Yy]$ ]]
|
||||
then
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
case $OPTION in
|
||||
1)
|
||||
echo -n $webserver;;
|
||||
4)
|
||||
exec $doweFiles/$phpmyadmin;;
|
||||
2)
|
||||
exec $doweFiles/$mysql;;
|
||||
3)
|
||||
echo -n "SQLite3";;
|
||||
5)
|
||||
echo -n "Gittea";;
|
||||
0)
|
||||
echo -n "Install All";;
|
||||
*)
|
||||
echo -n "\n ${Red} ERROR: Option $OPTION not available...${Color_Off}\n";;
|
||||
esac
|
||||
# Reload settings / files
|
||||
#########################
|
||||
reload() {
|
||||
source ~/.bashrc
|
||||
sudo service ssh restart
|
||||
# Empty Temp dir?
|
||||
}
|
||||
|
||||
welcome() {
|
||||
echo -e "${Cyan} Welcome to the Dowe Server Files Installation....${Color_Off}";
|
||||
|
||||
}
|
||||
|
||||
install_nginx() {
|
||||
read -p " Would you like to install NGINX? (Y/n) " -n 1 -r
|
||||
echo
|
||||
if [[ $REPLY =~ ^[yY]$ ]]
|
||||
then
|
||||
# Download the NGINX Files
|
||||
sudo curl -s ${REPO}${doweFiles}/$nginx
|
||||
|
||||
elif [[ ! $REPLY =~ ^[Yy]$ ]]
|
||||
then
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
welcome
|
||||
bashrc
|
||||
motd
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
# echo -n "Options are: [1] NGINX, [2] MySql, [3] SQLite3, [4] PHPMyAdmin, [5] Gittea, [0] Install All | ";
|
||||
|
||||
# read OPTION;
|
||||
|
||||
# case $OPTION in
|
||||
# 1)
|
||||
# exec $doweFiles/$nginx;;
|
||||
# 4)
|
||||
# exec $doweFiles/$phpmyadmin;;
|
||||
# 2)
|
||||
# exec $doweFiles/$mysql;;
|
||||
# 3)
|
||||
# echo -n "SQLite3";;
|
||||
# 5)
|
||||
# echo -n "Gittea";;
|
||||
# 0)
|
||||
# echo -n "Install All";;
|
||||
# *)
|
||||
# echo -n "\n ${Red} ERROR: Option $OPTION not available...${Color_Off}\n";;
|
||||
# esac
|
||||
|
||||
|
||||
echo "Reloadig.. "
|
||||
reload
|
||||
|
||||
echo "All done. Enjoy!"
|
|
@ -0,0 +1,104 @@
|
|||
# raspberry-pi-motd
|
||||
|
||||
## Message of the Day for the Raspberry Pi ####
|
||||
|
||||
All the work below is my customisation of motd from the forum thread on [raspberrypi.org](https://www.raspberrypi.org/forums/viewtopic.php?t=23440)
|
||||
|
||||
|
||||
### motd1.sh:
|
||||
<p align="center">
|
||||
<img src="https://github.com/yoannportugal/raspberry-pi-motd/blob/master/motd1.png"/>
|
||||
</p>
|
||||
|
||||
### motd2.sh:
|
||||
<p align="center">
|
||||
<img src="https://github.com/yoannportugal/raspberry-pi-motd/blob/master/motd2.png"/>
|
||||
</p>
|
||||
|
||||
### motd3.sh:
|
||||
<p align="center">
|
||||
<img src="https://github.com/yoannportugal/raspberry-pi-motd/blob/master/motd3.png"/>
|
||||
</p>
|
||||
|
||||
### motd4.sh:
|
||||
<p align="center">
|
||||
<img src="https://github.com/yoannportugal/raspberry-pi-motd/blob/master/motd4.png"/>
|
||||
</p>
|
||||
|
||||
### motd5.sh:
|
||||
<p align="center">
|
||||
<img src="https://github.com/yoannportugal/raspberry-pi-motd/blob/master/motd5.png"/>
|
||||
</p>
|
||||
|
||||
### motd6.sh: same than 4 with undervoltage info
|
||||
|
||||
Written in bash and tested with the Raspbian distribution.
|
||||
|
||||
- Create file `motd.sh` in `/etc`
|
||||
|
||||
```bash
|
||||
sudo nano /etc/motd.sh
|
||||
```
|
||||
Use one of the 2 different motd layout to fill this file.
|
||||
|
||||
- Change owner and make it executable:
|
||||
|
||||
```bash
|
||||
sudo chown root:root /etc/motd.sh && sudo chmod +x /etc/motd.sh
|
||||
```
|
||||
|
||||
- Add `/etc/motd.sh` as the last line in your `~/.profile` to execute the script when the user logs in via a tty console or ssh.
|
||||
|
||||
|
||||
- Remove the original motd file:
|
||||
|
||||
```bash
|
||||
sudo rm /etc/motd
|
||||
```
|
||||
|
||||
|
||||
You can remove the "last login" information. However it is considered a security risk. If you wish to do so, you should disable the `PrintLastLog` option from the `sshd` service. Edit the `/etc/ssh/sshd_config` file and uncomment the line `#PrintLastLog yes`:
|
||||
|
||||
```bash
|
||||
sudo nano /etc/ssh/sshd_config
|
||||
```
|
||||
|
||||
Before:
|
||||
|
||||
```text
|
||||
#PrintLastLog yes
|
||||
```
|
||||
|
||||
After:
|
||||
|
||||
```text
|
||||
PrintLastLog no
|
||||
```
|
||||
|
||||
Restart the `sshd` service:
|
||||
|
||||
```bash
|
||||
sudo /etc/init.d ssh restart
|
||||
```
|
||||
Now simply SSH into the Pi and enjoy the new motd.
|
||||
|
||||
Note: If you don't see the degree Celsius character correctly (`º`) make sure you have enabled a UTF8 locale.
|
||||
|
||||
|
||||
`motd2.sh` is copied from Retropie (Replaced Joystick with Raspberry Logo).
|
||||
|
||||
The ASCII logo came from a forum thread on [raspberrypi.org](https://www.raspberrypi.org/forums/viewtopic.php?f=63&t=5494#p78678)
|
||||
|
||||
|
||||
Auto installation:
|
||||
```
|
||||
git clone https://github.com/yoannportugal/raspberry-pi-motd
|
||||
sudo chown root:root /home/pi/raspberry-pi-motd/install-motd/install-motd && sudo chmod +x /home/pi/raspberry-pi-motd/install-motd/install-motd
|
||||
sudo sh /home/pi/raspberry-pi-motd/install-motd/install-motd
|
||||
cd /raspberry-pi-motd/install-motd
|
||||
sudo sh install-motd
|
||||
sudo echo "/etc/motd.sh" >> ~/.profile
|
||||
rm -R /home/pi/raspberry-pi-motd
|
||||
```
|
||||
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
#!/bin/bash
|
||||
# Install motd
|
||||
cp ./motd.sh /etc
|
||||
|
||||
sudo chown root:root /etc/motd.sh && sudo chmod +x /etc/motd.sh
|
||||
|
||||
sudo rm /etc/motd
|
||||
|
|
@ -0,0 +1,39 @@
|
|||
#!/bin/bash
|
||||
|
||||
let upSeconds="$(/usr/bin/cut -d. -f1 /proc/uptime)"
|
||||
let secs=$((${upSeconds}%60))
|
||||
let mins=$((${upSeconds}/60%60))
|
||||
let hours=$((${upSeconds}/3600%24))
|
||||
let days=$((${upSeconds}/86400))
|
||||
UPTIME=`printf "%d days, %02dh%02dm%02ds" "$days" "$hours" "$mins" "$secs"`
|
||||
|
||||
MEM=`free -m | awk 'NR==2 { printf "Total: %sMB, Used: %sMB, Free: %sMB",$2,$3,$4; }'`
|
||||
DISK=`df -h ~ | awk 'NR==2 { printf "Total: %sB, Used: %sB, Free: %sB",$2,$3,$4; }'`
|
||||
TEMP=`/opt/vc/bin/vcgencmd measure_temp | cut -c "6-9"`
|
||||
VAR_IP_INTERN="$(hostname -I)"
|
||||
THROTTLED=`/opt/vc/bin/vcgencmd get_throttled`
|
||||
|
||||
# get the load averages
|
||||
read one five fifteen rest < /proc/loadavg
|
||||
|
||||
DARKGREY="$(tput sgr0 ; tput bold ; tput setaf 0)"
|
||||
RED="$(tput sgr0 ; tput setaf 1)"
|
||||
GREEN="$(tput sgr0 ; tput setaf 2)"
|
||||
YELLOW="$(tput sgr0 ; tput setaf 3)"
|
||||
BLUE="$(tput sgr0 ; tput setaf 4)"
|
||||
WHITE="$(tput sgr0 ; tput setaf 7)"
|
||||
NC="$(tput sgr0)" # No Color
|
||||
|
||||
echo "${GREEN}
|
||||
.~~. .~~. ${YELLOW}`hostname -f`${GREEN}
|
||||
'. \ ' ' / .' ${YELLOW}`date +"%A, %e %B %Y, %H:%M:%S"`${RED}
|
||||
.~ .~~~..~.
|
||||
: .~.'~'.~. : ${DARKGREY}Uptime.............: ${WHITE}${UPTIME}${RED}
|
||||
~ ( ) ( ) ~ ${DARKGREY}Memory.............: ${WHITE}${MEM}${RED}
|
||||
( : '~'.~.'~' : ) ${DARKGREY}Disk usage.........: ${WHITE}${DISK}${RED}
|
||||
~ .~ ( ) ~. ~ ${DARKGREY}Load Averages......: ${WHITE}${one}, ${five}, ${fifteen} (1, 5, 15 min)${RED}
|
||||
( : '~' : ) ${DARKGREY}Running Processes..: ${WHITE}`ps ax | wc -l | tr -d " "`${RED}
|
||||
'~ .~~~. ~' ${DARKGREY}IP Addresses.......: ${WHITE}${VAR_IP_INTERN}${RED}
|
||||
'~' ${DARKGREY}Temperature........: ${WHITE}${TEMP}ºC${RED}
|
||||
${DARKGREY}Throttled..........: ${WHITE}${THROTTLED}${RED}
|
||||
${NC}"
|
Binary file not shown.
After Width: | Height: | Size: 42 KiB |
|
@ -0,0 +1,143 @@
|
|||
#!/bin/bash
|
||||
#----------------------------------------------------------------------------#
|
||||
# create file motd.sh in /etc
|
||||
# make it executable: sudo chown root:root /etc/motd.sh && sudo chmod +x /etc/motd.sh
|
||||
# add /etc/motd.sh as the last line in your ~/.profile
|
||||
# remove the original motd file: sudo rm /etc/motd
|
||||
#
|
||||
#----------------------------------------------------------------------------#
|
||||
|
||||
clear
|
||||
|
||||
function color (){
|
||||
echo "\e[$1m$2\e[0m"
|
||||
}
|
||||
|
||||
function extend (){
|
||||
local str="$1"
|
||||
let spaces=60-${#1}
|
||||
while [ $spaces -gt 0 ]; do
|
||||
str="$str "
|
||||
let spaces=spaces-1
|
||||
done
|
||||
echo "$str"
|
||||
}
|
||||
|
||||
function center (){
|
||||
local str="$1"
|
||||
let spacesLeft=(78-${#1})/2
|
||||
let spacesRight=78-spacesLeft-${#1}
|
||||
while [ $spacesLeft -gt 0 ]; do
|
||||
str=" $str"
|
||||
let spacesLeft=spacesLeft-1
|
||||
done
|
||||
|
||||
while [ $spacesRight -gt 0 ]; do
|
||||
str="$str "
|
||||
let spacesRight=spacesRight-1
|
||||
done
|
||||
|
||||
echo "$str"
|
||||
}
|
||||
|
||||
function sec2time (){
|
||||
local input=$1
|
||||
|
||||
if [ $input -lt 60 ]; then
|
||||
echo "$input seconds"
|
||||
else
|
||||
((days=input/86400))
|
||||
((input=input%86400))
|
||||
((hours=input/3600))
|
||||
((input=input%3600))
|
||||
((mins=input/60))
|
||||
|
||||
local daysPlural="s"
|
||||
local hoursPlural="s"
|
||||
local minsPlural="s"
|
||||
|
||||
if [ $days -eq 1 ]; then
|
||||
daysPlural=""
|
||||
fi
|
||||
|
||||
if [ $hours -eq 1 ]; then
|
||||
hoursPlural=""
|
||||
fi
|
||||
|
||||
if [ $mins -eq 1 ]; then
|
||||
minsPlural=""
|
||||
fi
|
||||
|
||||
echo "$days day$daysPlural, $hours hour$hoursPlural, $mins minute$minsPlural"
|
||||
fi
|
||||
}
|
||||
|
||||
borderColor=35
|
||||
headerLeafColor=32
|
||||
headerRaspberryColor=31
|
||||
greetingsColor=33
|
||||
statsLabelColor=36
|
||||
|
||||
borderLine="━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
|
||||
borderTopLine=$(color $borderColor "┏$borderLine┓")
|
||||
borderBottomLine=$(color $borderColor "┗$borderLine┛")
|
||||
borderBar=$(color $borderColor "┃")
|
||||
borderEmptyLine="$borderBar $borderBar"
|
||||
|
||||
# Header
|
||||
header="$borderTopLine\n$borderEmptyLine\n"
|
||||
header="$header$borderBar$(color $headerLeafColor " .~~. .~~. ")$borderBar\n"
|
||||
header="$header$borderBar$(color $headerLeafColor " '. \ ' ' / .' ")$borderBar\n"
|
||||
header="$header$borderBar$(color $headerRaspberryColor " .~ .~~~..~. _ _ ")$borderBar\n"
|
||||
header="$header$borderBar$(color $headerRaspberryColor " : .~.'~'.~. : ___ ___ ___ ___| |_ ___ ___ ___ _ _ ___|_| ")$borderBar\n"
|
||||
header="$header$borderBar$(color $headerRaspberryColor " ~ ( ) ( ) ~ | _| .'|_ -| . | . | -_| _| _| | | | . | | ")$borderBar\n"
|
||||
header="$header$borderBar$(color $headerRaspberryColor " ( : '~'.~.'~' : ) |_| |__,|___| _|___|___|_| |_| |_ | | _|_| ")$borderBar\n"
|
||||
header="$header$borderBar$(color $headerRaspberryColor " ~ .~ ( ) ~. ~ |_| |___| |_| ")$borderBar\n"
|
||||
header="$header$borderBar$(color $headerRaspberryColor " ( : '~' : ) ")$borderBar\n"
|
||||
header="$header$borderBar$(color $headerRaspberryColor " '~ .~~~. ~' ")$borderBar\n"
|
||||
header="$header$borderBar$(color $headerRaspberryColor " '~' ")$borderBar"
|
||||
|
||||
me=$(whoami)
|
||||
|
||||
# Greetings
|
||||
greetings="$borderBar$(color $greetingsColor "$(center "Welcome back, $me!")")$borderBar\n"
|
||||
greetings="$greetings$borderBar$(color $greetingsColor "$(center "$(date +"%A, %d %B %Y, %T")")")$borderBar"
|
||||
|
||||
# System information
|
||||
read loginFrom loginIP loginDate <<< $(last $me --time-format iso -2 | awk 'NR==2 { print $2,$3,$4 }')
|
||||
|
||||
# TTY login
|
||||
if [[ $loginDate == - ]]; then
|
||||
loginDate=$loginIP
|
||||
loginIP=$loginFrom
|
||||
fi
|
||||
|
||||
if [[ $loginDate == *T* ]]; then
|
||||
login="$(date -d $loginDate +"%A, %d %B %Y, %T") ($loginIP)"
|
||||
else
|
||||
# Not enough logins
|
||||
login="None"
|
||||
fi
|
||||
|
||||
label1="$(extend "$login")"
|
||||
label1="$borderBar $(color $statsLabelColor "Last Login....:") $label1$borderBar"
|
||||
|
||||
uptime="$(sec2time $(cut -d "." -f 1 /proc/uptime))"
|
||||
uptime="$uptime ($(date -d "@"$(grep btime /proc/stat | cut -d " " -f 2) +"%d-%m-%Y %H:%M:%S"))"
|
||||
|
||||
label2="$(extend "$uptime")"
|
||||
label2="$borderBar $(color $statsLabelColor "Uptime........:") $label2$borderBar"
|
||||
|
||||
label3="$(extend "$(free -m | awk 'NR==2 { printf "Total: %sMB, Used: %sMB, Free: %sMB",$2,$3,$4; }')")"
|
||||
label3="$borderBar $(color $statsLabelColor "Memory........:") $label3$borderBar"
|
||||
|
||||
label4="$(extend "$(df -h ~ | awk 'NR==2 { printf "Total: %sB, Used: %sB, Free: %sB",$2,$3,$4; }')")"
|
||||
label4="$borderBar $(color $statsLabelColor "Disk usage....:") $label4$borderBar"
|
||||
|
||||
label5="$(extend "$(/opt/vc/bin/vcgencmd measure_temp | cut -c "6-9")ºC")"
|
||||
label5="$borderBar $(color $statsLabelColor "Temperature...:") $label5$borderBar"
|
||||
|
||||
stats="$label1\n$label2\n$label3\n$label4\n$label5"
|
||||
|
||||
# Print motd
|
||||
echo -e "$header\n$borderEmptyLine\n$greetings\n$borderEmptyLine\n$stats\n$borderEmptyLine\n$borderBottomLine"
|
Binary file not shown.
After Width: | Height: | Size: 47 KiB |
|
@ -0,0 +1,121 @@
|
|||
#!/bin/bash
|
||||
#----------------------------------------------------------------------------#
|
||||
# create file motd.sh in /etc
|
||||
# make it executable: sudo chown root:root /etc/motd.sh && sudo chmod +x /etc/motd.sh
|
||||
# add /etc/motd.sh as the last line in your ~/.profile
|
||||
# remove the original motd file:
|
||||
#
|
||||
#----------------------------------------------------------------------------#
|
||||
|
||||
function pie_ssh_welcome() {
|
||||
local upSeconds="$(/usr/bin/cut -d. -f1 /proc/uptime)"
|
||||
local secs=$((upSeconds%60))
|
||||
local mins=$((upSeconds/60%60))
|
||||
local hours=$((upSeconds/3600%24))
|
||||
local days=$((upSeconds/86400))
|
||||
local UPTIME=$(printf "%d days, %02dh%02dm%02ds" "$days" "$hours" "$mins" "$secs")
|
||||
|
||||
# calculate rough CPU and GPU temperatures:sudo
|
||||
local cpuTempC
|
||||
local cpuTempF
|
||||
local gpuTempC
|
||||
local gpuTempF
|
||||
if [[ -f "/sys/class/thermal/thermal_zone0/temp" ]]; then
|
||||
cpuTempC=$(($(cat /sys/class/thermal/thermal_zone0/temp)/1000)) && cpuTempF=$((cpuTempC*9/5+32))
|
||||
fi
|
||||
|
||||
if [[ -f "/opt/vc/bin/vcgencmd" ]]; then
|
||||
if gpuTempC=$(/opt/vc/bin/vcgencmd measure_temp); then
|
||||
gpuTempC=${gpuTempC:5:2}
|
||||
gpuTempF=$((gpuTempC*9/5+32))
|
||||
else
|
||||
gpuTempC=""
|
||||
fi
|
||||
fi
|
||||
|
||||
local df_out=()
|
||||
local line
|
||||
while read line; do
|
||||
df_out+=("$line")
|
||||
done < <(df -h /)
|
||||
|
||||
local rst="$(tput sgr0)"
|
||||
local fgblk="${rst}$(tput setaf 0)" # Black - Regular
|
||||
local fgred="${rst}$(tput setaf 1)" # Red
|
||||
local fggrn="${rst}$(tput setaf 2)" # Green
|
||||
local fgylw="${rst}$(tput setaf 3)" # Yellow
|
||||
local fgblu="${rst}$(tput setaf 4)" # Blue
|
||||
local fgpur="${rst}$(tput setaf 5)" # Purple
|
||||
local fgcyn="${rst}$(tput setaf 6)" # Cyan
|
||||
local fgwht="${rst}$(tput setaf 7)" # White
|
||||
|
||||
local bld="$(tput bold)"
|
||||
local bfgblk="${bld}$(tput setaf 0)"
|
||||
local bfgred="${bld}$(tput setaf 1)"
|
||||
local bfggrn="${bld}$(tput setaf 2)"
|
||||
local bfgylw="${bld}$(tput setaf 3)"
|
||||
local bfgblu="${bld}$(tput setaf 4)"
|
||||
local bfgpur="${bld}$(tput setaf 5)"
|
||||
local bfgcyn="${bld}$(tput setaf 6)"
|
||||
local bfgwht="${bld}$(tput setaf 7)"
|
||||
|
||||
local logo=(
|
||||
"${fggrn} "
|
||||
"${fggrn} .~~. .~~. "
|
||||
"${fggrn} '. \ ' ' / .' "
|
||||
"${fgred} .~ .~~~..~. "
|
||||
"${fgred} : .~.'~'.~. : "
|
||||
"${fgred} ~ ( ) ( ) ~ "
|
||||
"${fgred}( : '~'.~.'~' : ) "
|
||||
"${fgred} ~ .~ ( ) ~. ~ "
|
||||
"${fgred} ( : '~' : ) "
|
||||
"${fgred} '~ .~~~. ~' "
|
||||
"${fgred} '~' "
|
||||
"${fgred} "
|
||||
)
|
||||
|
||||
local out
|
||||
local i
|
||||
for i in "${!logo[@]}"; do
|
||||
out+=" ${logo[$i]} "
|
||||
case "$i" in
|
||||
0)
|
||||
out+="${fgcyn}$(date +"%A, %e %B %Y, %H:%M:%S")"
|
||||
;;
|
||||
1)
|
||||
out+="${fgcyn}$(uname -srmo)"
|
||||
;;
|
||||
3)
|
||||
out+="${fgylw}${df_out[0]}"
|
||||
;;
|
||||
4)
|
||||
out+="${fgwht}${df_out[1]}"
|
||||
;;
|
||||
5)
|
||||
out+="${fgred}Uptime.............:""${fgwht} ${UPTIME}"
|
||||
;;
|
||||
6)
|
||||
out+="${fgred}Memory.............:""${fgwht} $(free -m | awk 'NR==2 { printf "Total: %sMB, Used: %sMB, Free: %sMB",$2,$3,$4; }')"
|
||||
;;
|
||||
7)
|
||||
out+="${fgred}Disk Usage... .....:""${fgwht} $(df -h ~ | awk 'NR==2 { printf "Total: %sB, Used: %sB, Free: %sB",$2,$3,$4; }')"
|
||||
;;
|
||||
8)
|
||||
out+="${fgred}Running Processes..:""${fgwht} $(ps ax | wc -l | tr -d " ")"
|
||||
;;
|
||||
9)
|
||||
out+="${fgred}IP Address.........:""${fgwht} $(ip route get 8.8.8.8 2>/dev/null | awk '{print $NF; exit}')"
|
||||
;;
|
||||
10)
|
||||
out+="Temperature........:""${fgwht} CPU: $cpuTempC°C GPU: $gpuTempC°C"
|
||||
;;
|
||||
11)
|
||||
out+="${fgblu}Raspberry PI Foundation, https://www.raspberrypi.org/"
|
||||
;;
|
||||
esac
|
||||
out+="\n"
|
||||
done
|
||||
echo -e "\n$out"
|
||||
}
|
||||
|
||||
pie_ssh_welcome
|
Binary file not shown.
After Width: | Height: | Size: 38 KiB |
|
@ -0,0 +1,38 @@
|
|||
#!/bin/bash
|
||||
|
||||
let upSeconds="$(/usr/bin/cut -d. -f1 /proc/uptime)"
|
||||
let secs=$((${upSeconds}%60))
|
||||
let mins=$((${upSeconds}/60%60))
|
||||
let hours=$((${upSeconds}/3600%24))
|
||||
let days=$((${upSeconds}/86400))
|
||||
UPTIME=`printf "%d days, %02dh%02dm%02ds" "$days" "$hours" "$mins" "$secs"`
|
||||
|
||||
MEMFREE=`cat /proc/meminfo | grep MemFree | awk {'print $2'}`
|
||||
MEMTOTAL=`cat /proc/meminfo | grep MemTotal | awk {'print $2'}`
|
||||
|
||||
TEMP=`/opt/vc/bin/vcgencmd measure_temp | cut -c "6-9"`
|
||||
|
||||
SDUSED=`df -h | grep 'dev/root' | awk '{print $3}' | xargs`
|
||||
SDAVAIL=`df -h | grep 'dev/root' | awk '{print $4}' | xargs`
|
||||
|
||||
# get the load averages
|
||||
read one five fifteen rest < /proc/loadavg
|
||||
|
||||
DARKGREY="$(tput sgr0 ; tput bold ; tput setaf 0)"
|
||||
RED="$(tput sgr0 ; tput setaf 1)"
|
||||
GREEN="$(tput sgr0 ; tput setaf 2)"
|
||||
BLUE="$(tput sgr0 ; tput setaf 4)"
|
||||
NC="$(tput sgr0)" # No Color
|
||||
|
||||
echo "${GREEN}
|
||||
.~~. .~~. `hostname -f`
|
||||
'. \ ' ' / .' `date +"%A, %e %B %Y, %H:%M:%S"`${RED}
|
||||
.~ .~~~..~.
|
||||
: .~.'~'.~. : ${DARKGREY}Uptime.............: ${BLUE}${UPTIME}${RED}
|
||||
~ ( ) ( ) ~ ${DARKGREY}Memory.............: ${BLUE}${MEMFREE}kB (Free) / ${MEMTOTAL}kB (Total)${RED}
|
||||
( : '~'.~.'~' : ) ${DARKGREY}Disk usage.........: ${BLUE}${SDUSED} (Used) / ${SDAVAIL} (Free)${RED}
|
||||
~ .~ ( ) ~. ~ ${DARKGREY}Load Averages......: ${BLUE}${one}, ${five}, ${fifteen} (1, 5, 15 min)${RED}
|
||||
( : '~' : ) ${DARKGREY}Running Processes..: ${BLUE}`ps ax | wc -l | tr -d " "`${RED}
|
||||
'~ .~~~. ~' ${DARKGREY}IP Addresses.......: ${BLUE}`hostname -I`${RED}
|
||||
'~' ${DARKGREY}Temperature........: ${BLUE}${TEMP}ºC${RED}
|
||||
${NC}"
|
Binary file not shown.
After Width: | Height: | Size: 35 KiB |
|
@ -0,0 +1,37 @@
|
|||
#!/bin/bash
|
||||
|
||||
let upSeconds="$(/usr/bin/cut -d. -f1 /proc/uptime)"
|
||||
let secs=$((${upSeconds}%60))
|
||||
let mins=$((${upSeconds}/60%60))
|
||||
let hours=$((${upSeconds}/3600%24))
|
||||
let days=$((${upSeconds}/86400))
|
||||
UPTIME=`printf "%d days, %02dh%02dm%02ds" "$days" "$hours" "$mins" "$secs"`
|
||||
|
||||
MEM=`free -m | awk 'NR==2 { printf "Total: %sMB, Used: %sMB, Free: %sMB",$2,$3,$4; }'`
|
||||
DISK=`df -h ~ | awk 'NR==2 { printf "Total: %sB, Used: %sB, Free: %sB",$2,$3,$4; }'`
|
||||
TEMP=`/opt/vc/bin/vcgencmd measure_temp | cut -c "6-9"`
|
||||
VAR_IP_INTERN="$(hostname -I)"
|
||||
|
||||
# get the load averages
|
||||
read one five fifteen rest < /proc/loadavg
|
||||
|
||||
DARKGREY="$(tput sgr0 ; tput bold ; tput setaf 0)"
|
||||
RED="$(tput sgr0 ; tput setaf 1)"
|
||||
GREEN="$(tput sgr0 ; tput setaf 2)"
|
||||
YELLOW="$(tput sgr0 ; tput setaf 3)"
|
||||
BLUE="$(tput sgr0 ; tput setaf 4)"
|
||||
WHITE="$(tput sgr0 ; tput setaf 7)"
|
||||
NC="$(tput sgr0)" # No Color
|
||||
|
||||
echo "${GREEN}
|
||||
.~~. .~~. ${YELLOW}`hostname -f`${GREEN}
|
||||
'. \ ' ' / .' ${YELLOW}`date +"%A, %e %B %Y, %H:%M:%S"`${RED}
|
||||
.~ .~~~..~.
|
||||
: .~.'~'.~. : ${DARKGREY}Uptime.............: ${WHITE}${UPTIME}${RED}
|
||||
~ ( ) ( ) ~ ${DARKGREY}Memory.............: ${WHITE}${MEM}${RED}
|
||||
( : '~'.~.'~' : ) ${DARKGREY}Disk usage.........: ${WHITE}${DISK}${RED}
|
||||
~ .~ ( ) ~. ~ ${DARKGREY}Load Averages......: ${WHITE}${one}, ${five}, ${fifteen} (1, 5, 15 min)${RED}
|
||||
( : '~' : ) ${DARKGREY}Running Processes..: ${WHITE}`ps ax | wc -l | tr -d " "`${RED}
|
||||
'~ .~~~. ~' ${DARKGREY}IP Addresses.......: ${WHITE}${VAR_IP_INTERN}${RED}
|
||||
'~' ${DARKGREY}Temperature........: ${WHITE}${TEMP}ºC${RED}
|
||||
${NC}"
|
Binary file not shown.
After Width: | Height: | Size: 37 KiB |
|
@ -0,0 +1,38 @@
|
|||
#!/bin/bash
|
||||
|
||||
let upSeconds="$(/usr/bin/cut -d. -f1 /proc/uptime)"
|
||||
let secs=$((${upSeconds}%60))
|
||||
let mins=$((${upSeconds}/60%60))
|
||||
let hours=$((${upSeconds}/3600%24))
|
||||
let days=$((${upSeconds}/86400))
|
||||
UPTIME=`printf "%d days, %02dh%02dm%02ds" "$days" "$hours" "$mins" "$secs"`
|
||||
VAR_IP_INTERN="$(hostname -I)"
|
||||
VAR_IP_EXTERN4="$(wget -q -O - http://ipv4.icanhazip.com/ | tail)"
|
||||
VAR_IP_EXTERN6="$(wget -q -O - http://ipv6.icanhazip.com/ | tail)"
|
||||
MEM=`free -m | awk 'NR==2 { printf "Total: %sMB, Used: %sMB, Free: %sMB",$2,$3,$4; }'`
|
||||
DISK=`df -h ~ | awk 'NR==2 { printf "Total: %sB, Used: %sB, Free: %sB",$2,$3,$4; }'`
|
||||
TEMP=`/opt/vc/bin/vcgencmd measure_temp | cut -c "6-9"`
|
||||
|
||||
# get the load averages
|
||||
read one five fifteen rest < /proc/loadavg
|
||||
|
||||
DARKGREY="$(tput sgr0 ; tput bold ; tput setaf 0)"
|
||||
RED="$(tput sgr0 ; tput setaf 1)"
|
||||
GREEN="$(tput sgr0 ; tput setaf 2)"
|
||||
YELLOW="$(tput sgr0 ; tput setaf 3)"
|
||||
BLUE="$(tput sgr0 ; tput setaf 4)"
|
||||
WHITE="$(tput sgr0 ; tput setaf 7)"
|
||||
NC="$(tput sgr0)" # No Color
|
||||
|
||||
echo "${GREEN}
|
||||
.~~. .~~. ${YELLOW}`hostname -f`${GREEN}
|
||||
'. \ ' ' / .' ${YELLOW}`date +"%A, %e %B %Y, %H:%M:%S"`${RED}
|
||||
.~ .~~~..~. ${DARKGREY}Uptime.............: ${WHITE}${UPTIME}${RED}
|
||||
: .~.'~'.~. : ${DARKGREY}Memory.............: ${WHITE}${MEM}${RED}
|
||||
~ ( ) ( ) ~ ${DARKGREY}Disk usage.........: ${WHITE}${DISK}${RED}
|
||||
( : '~'.~.'~' : ) ${DARKGREY}Load Averages......: ${WHITE}${one}, ${five}, ${fifteen} (1, 5, 15 min)${RED}
|
||||
~ .~ ( ) ~. ~ ${DARKGREY}Running Processes..: ${WHITE}`ps ax | wc -l | tr -d " "`${RED}
|
||||
( : '~' : ) ${DARKGREY}Local IP...........: ${WHITE}${VAR_IP_INTERN}${RED}
|
||||
'~ .~~~. ~' ${DARKGREY}External IP........: ${WHITE}${VAR_IP_EXTERN4} ${VAR_IP_EXTERN6}${RED}
|
||||
'~' ${DARKGREY}Temperature........: ${WHITE}${TEMP}ºC${RED}
|
||||
${NC}"
|
|
@ -0,0 +1,38 @@
|
|||
#!/bin/bash
|
||||
|
||||
let upSeconds="$(/usr/bin/cut -d. -f1 /proc/uptime)"
|
||||
let secs=$((${upSeconds}%60))
|
||||
let mins=$((${upSeconds}/60%60))
|
||||
let hours=$((${upSeconds}/3600%24))
|
||||
let days=$((${upSeconds}/86400))
|
||||
UPTIME=`printf "%d days, %02dh%02dm%02ds" "$days" "$hours" "$mins" "$secs"`
|
||||
|
||||
MEM=`free -m | awk 'NR==2 { printf "Total: %sMB, Used: %sMB, Free: %sMB",$2,$3,$4; }'`
|
||||
DISK=`df -h ~ | awk 'NR==2 { printf "Total: %sB, Used: %sB, Free: %sB",$2,$3,$4; }'`
|
||||
TEMP=`/opt/vc/bin/vcgencmd measure_temp | cut -c "6-9"`
|
||||
VAR_IP_INTERN="$(hostname -I)"
|
||||
THROTTLED=`/opt/vc/bin/vcgencmd get_throttled`
|
||||
# get the load averages
|
||||
read one five fifteen rest < /proc/loadavg
|
||||
|
||||
DARKGREY="$(tput sgr0 ; tput bold ; tput setaf 0)"
|
||||
RED="$(tput sgr0 ; tput setaf 1)"
|
||||
GREEN="$(tput sgr0 ; tput setaf 2)"
|
||||
YELLOW="$(tput sgr0 ; tput setaf 3)"
|
||||
BLUE="$(tput sgr0 ; tput setaf 4)"
|
||||
WHITE="$(tput sgr0 ; tput setaf 7)"
|
||||
NC="$(tput sgr0)" # No Color
|
||||
|
||||
echo "${GREEN}
|
||||
.~~. .~~. ${YELLOW}`hostname -f`${GREEN}
|
||||
'. \ ' ' / .' ${YELLOW}`date +"%A, %e %B %Y, %H:%M:%S"`${RED}
|
||||
.~ .~~~..~.
|
||||
: .~.'~'.~. : ${DARKGREY}Uptime.............: ${WHITE}${UPTIME}${RED}
|
||||
~ ( ) ( ) ~ ${DARKGREY}Memory.............: ${WHITE}${MEM}${RED}
|
||||
( : '~'.~.'~' : ) ${DARKGREY}Disk usage.........: ${WHITE}${DISK}${RED}
|
||||
~ .~ ( ) ~. ~ ${DARKGREY}Load Averages......: ${WHITE}${one}, ${five}, ${fifteen} (1, 5, 15 min)${RED}
|
||||
( : '~' : ) ${DARKGREY}Running Processes..: ${WHITE}`ps ax | wc -l | tr -d " "`${RED}
|
||||
'~ .~~~. ~' ${DARKGREY}IP Addresses.......: ${WHITE}${VAR_IP_INTERN}${RED}
|
||||
'~' ${DARKGREY}Temperature........: ${WHITE}${TEMP}ºC${RED}
|
||||
${DARKGREY}Throttled..........: ${WHITE}${THROTTLED}${RED}
|
||||
${NC}"
|
Loading…
Reference in New Issue