From 9705546bd0f6b289bf3a2227829671afeec7050c Mon Sep 17 00:00:00 2001 From: Erreur32 Date: Sun, 30 Jul 2017 22:19:15 +0200 Subject: [PATCH 1/9] Delete install.sh --- install.sh | 249 ----------------------------------------------------- 1 file changed, 249 deletions(-) delete mode 100644 install.sh diff --git a/install.sh b/install.sh deleted file mode 100644 index 3390f1a..0000000 --- a/install.sh +++ /dev/null @@ -1,249 +0,0 @@ -#!/bin/sh -# -# MOTDs32 installation instructions -# ================================== -# -# (2017) New project MOTDs32 Customized by Erreur32 -# Version 0.0.5 -# -# https://gitlab.echosystem.fr/Erreur32/MOTDs32 -# -# ,--. ,--. ,-----. ,--------.,------. ,----. ,---. -# | `.' |' .-. ''--. .--'| .-. \ ,---. '.-. |'.-. \ -# | |'.'| || | | | | | | | \ :( .-' .' < .-' .' -# | | | |' '-' ' | | | '--' /.-' `)/'-' |/ '-. -# `--' `--' `-----' `--' `-------' `----' `----' '-----' -# -# | + Stats32 | -# -# MOTDstat is dynamicaly refreshing the /etc/motd file with current informations -# about system status and usage. -# -# Copyright 2017 🅴🆁🆁🅴🆄🆁32 -# original project: Pavol Krigler -# -# make sur this file is executable +x -################################################################################ -# -# Installation -# ============ -# -# As root execute this command (the easy way!): -# -# ./install.sh -# -################################################################################ -# Make sure only root can run our script -if [[ $EUID -ne 0 ]]; then - echo "This script must be run as root" 1>&2 - exit 1 -fi - -## clean terminal -#clear; -BG_BLUE="$(tput setab 4)" -BG_BLACK="$(tput setab 0)" -FG_GREEN="$(tput setaf 2)" -FG_WHITE="$(tput setaf 7)" -# Save screen -tput smcup -# Display menu until selection == 0 -while [[ $REPLY != 0 ]]; do -echo -n ${BG_BLACK}${FG_WHITE} -clear -cat <<- "EOFMO" - - Installation of MOTDs32 | + Stats32 | - - ,--. ,--. ,-----. ,--------.,------. ,----. ,---. - | `.' |' .-. ''--. .--'| .-. \ ,---. '.-. |'.-. \ - | |'.'| || | | | | | | | \ :( .-' .' ; .-' .' - | | | |' '-' ' | | | '--' /.-' `)/'-' |/ '-. - `--' `--' `-----' `--' `-------' `----' `----' '-----' - - By Erreur32 - -EOFMO -echo -e "\033[1;30m # MOTDs32 is dynamicaly refreshing the /etc/motd file with current informations" -echo -e "\033[1;30m # about system status and usage." -echo -e "\n \e[34m Installation of MOTDs32 in progress... \e[0m\n\n" - -# Check files -#echo -e " -->\e[34m Check files:" -if hash figlet 2>/dev/null; then -echo -e " \e[34m- Figlet \e[32minstalled.\e[0m" - else -echo -e " \e[34m- Figlet \e[1;31mis not installed.\e[0m" - fi -if hash ntpd 2>/dev/null; then -echo -e " \e[34m- NTP \e[32minstalled.\e[0m" - else -echo -e " \e[34m- NTP \e[1;31mis not installed.\e[0m" - fi -if hash make 2>/dev/null; then -echo -e " \e[34m- build-essential \e[32minstalled.\e[0m" - else -echo -e " \e[34m- build-essential \e[1;31mis not installed.\e[0m" - fi -echo -e "\n YOU CAN SKIP auto install if you want" -echo -e "\n\e[92m Please Select:" -echo -e " 1. \e[0m(auto)Install Missing Package\e[92m" -echo -e " 2. \e[0mContinue installation script\e[92m" -echo -e " 0. \e[0mQuit\n \e[0m" -read -p " Enter selection [0-2] > " selection - -# Clear area beneath menu -tput cup 10 0 -echo -n ${BG_BLACK}${FG_GREEN} -tput ed -tput cup 11 0 - - # Act on selection - case $selection in - 1) echo -e " \e[32m install missing package ...\e[0m\n" - apt-get install -y build-essential ntp figlet - echo -e "\n\e[34m - apt-get installation build-essential ntp figlet \e[0m>> Succesfull" - if [ -f "/usr/bin/motds32" ] - then - echo -e "\n\e[34m - Make file \e[0m>> already done.\e[0m\n" - else - echo -e "\n\e[92m -Building binary \e[0m\n" - make install - echo -e "\n\e[34m - Make file done.\e[0m\n" - fi - - echo -e "\e[92m" - if [ `grep -c /etc/motd /root/.bashrc` == 0 ] - then - echo -e " \e[1;31m code bash missing" - echo "cat /etc/motd" >> /root/.bashrc - echo -e "\e[92m - Code bash \e[0madded.\n" - else - grepmot=`grep '/etc/motd' /root/.bashrc` - echo -e " \e[1;30m Code bash found: \e[0m>>\e[0m $grepmot \e[0m<<\n" - echo -e " -->\e[34m Code bash: \e[92mOK\e[0m" - #sed -i '/cat \/etc\/motd/d' /root/.bashrc - #echo -e "\e[92m Code .bashrc remove.\e[0m" - fi - - # Check if MOTDs32 is already add - if [ -f "/etc/motds32/Stats32" ] - then - echo -e " -->\e[34m Stats32 \e[92mFOUND\e[0m" - else - mkdir /etc/motds32; - cp Stats32 /etc/motds32/Stats32 -Rf - echo -e " -->\e[34m Stats32 \e[92mINSTALLED\e[0m" - fi - - # Copy font figlet - if [ -f "/usr/share/figlet" ] - then - echo -e " -->\e[31m figlet not FOUND\e[0m" - else - cp -Rf fonts/chunky.flf /usr/share/figlet/ - echo -e " -->\e[34m Font figlet \e[92mOK\e[0m" - fi - - # Check if motd is installed correctly - if [ -f "/usr/bin/motd" ] - then - echo -e " -->\e[34m motd check \e[92mOK\e[0m\n" - else - ln -s /usr/bin/motds32 /usr/bin/motd - echo -e " -->\e[34m motd bin \e[92mOK\e[0m\n" - fi - ## Install Crontab - if crontab -l | grep -q '/usr/bin/motds32'; then - echo -e "\e[34m - Cron \e[0m>> already added.\e[0m" - else - echo -e "\e[34m - Cron added.\e[0m" - (crontab -l ; echo "*/5 * * * * /usr/bin/motds32 -g 2>1")| crontab - - fi -## Generate first stats - /usr/bin/motds32 -g - - echo -e "\n\n\e[34m \e[92m Installation of MOTDs32 completed!\e[0m \n\n\n Help? Use: \n \033[1;30m /usr/bin/motds32\e[0m \n or \033[1;30m\n motd\e[0m\n" - printf "\n \e[1;33m (Press any key to exit.)\e[0m" - read -n 1 -echo "Installation MOTDs32 terminated." -exit 1 -# Restore screen -tput rmcup - ;; - 2) echo -e "\n\e[92m" - if [ `grep -c /etc/motd /root/.bashrc` == 0 ] - then - echo -e " code bash missing" - echo "cat /etc/motd" >> /root/.bashrc - echo -e "\e[92m - Code bash \e[0madded.\n" - else - grepmot=`grep '/etc/motd' /root/.bashrc` - echo -e " \e[1;30m Code bash found: \e[0m>>\e[0m $grepmot \e[0m<<\n" - echo -e " -->\e[34m Code bash: \e[92mOK\e[0m" - #sed -i '/cat \/etc\/motd/d' /root/.bashrc - #echo -e "\e[92m Code .bashrc remove.\e[0m" - fi - - # Check if MOTDs32 is already add - if [ -f "/etc/motds32/Stats32" ] - then - echo -e " -->\e[34m Stats32 \e[92mFOUND\e[0m" - else - mkdir /etc/motds32; - cp Stats32 /etc/motds32/Stats32 -Rf - echo -e " -->\e[34m Stats32 \e[92mINSTALLED\e[0m" - fi - - # Copy font figlet - if [ -f "/usr/share/figlet" ] - then - echo -e " -->\e[31m figlet not FOUND\e[0m" - else - cp -Rf fonts/chunky.flf /usr/share/figlet/ - echo -e " -->\e[34m Font figlet \e[92mOK\e[0m" - fi - - # Check if motd ins talled correctly - if [ -f "/usr/bin/motd" ] - then - echo -e " -->\e[34m motd check \e[92mOK\e[0m\n" - else - ln -s /usr/bin/motds32 /usr/bin/motd - echo -e " -->\e[34m motd bin \e[92mOK\e[0m\n" - fi - - ## Install Crontab - if crontab -l | grep -q '/usr/bin/motds32'; then - echo -e "\e[34m - Cron \e[0m>> already added.\e[0m" - else - echo -e "\e[34m - Cron added.\e[0m" - (crontab -l ; echo "*/5 * * * * /usr/bin/motds32 -g 2>1")| crontab - - fi -## Generate first stats - /usr/bin/motds32 -g - echo -e "\n\n\e[34m \e[92m Installation of MOTDs32 completed!\e[0m \n\n\n Help? Use: \n \033[1;30m /usr/bin/motds32\e[0m \n or \033[1;30m\n motd\e[0m\n" - printf "\n \e[1;33m (Press any key to exit.)\e[0m" - read -n 1 - echo "Installation MOTDs32 terminated." -exit 1 -# Restore screen -tput rmcup - ;; - 0) break - ;; - *) break - ;; - esac - -## Generate first stats - /usr/bin/motds32 -g - - echo -e "\n\n\e[34m \e[92m Installation of MOTDs32 completed!\e[0m \n\n\n Help? Use: \n \033[1;30m /usr/bin/motds32\e[0m \n or \033[1;30m\n motd\e[0m\n" - printf "\n \e[1;33m (Press any key to exit.)\e[0m" - read -n 1 -done - -# Restore screen -tput rmcup -echo "Installation MOTDs32 terminated." From 8d6fd00c490a62867863c40c24c89a669d961c5b Mon Sep 17 00:00:00 2001 From: Erreur32 Date: Sun, 30 Jul 2017 22:20:32 +0200 Subject: [PATCH 2/9] Update install-old.sh --- install-old.sh | 306 +++++++++++++++++++++++++++++-------------------- 1 file changed, 183 insertions(+), 123 deletions(-) diff --git a/install-old.sh b/install-old.sh index fe1ce88..3390f1a 100755 --- a/install-old.sh +++ b/install-old.sh @@ -33,11 +33,25 @@ # ./install.sh # ################################################################################ +# Make sure only root can run our script +if [[ $EUID -ne 0 ]]; then + echo "This script must be run as root" 1>&2 + exit 1 +fi ## clean terminal -clear; - -cat <<"EOF" +#clear; +BG_BLUE="$(tput setab 4)" +BG_BLACK="$(tput setab 0)" +FG_GREEN="$(tput setaf 2)" +FG_WHITE="$(tput setaf 7)" +# Save screen +tput smcup +# Display menu until selection == 0 +while [[ $REPLY != 0 ]]; do +echo -n ${BG_BLACK}${FG_WHITE} +clear +cat <<- "EOFMO" Installation of MOTDs32 | + Stats32 | @@ -47,143 +61,189 @@ cat <<"EOF" | | | |' '-' ' | | | '--' /.-' `)/'-' |/ '-. `--' `--' `-----' `--' `-------' `----' `----' '-----' - By Erreur32 + By Erreur32 -EOF - -echo -e "\033[1;30m# MOTDs32 is dynamicaly refreshing the /etc/motd file with current informations" -echo -e "\033[1;30m# about system status and usage." - - - -# Make sure only root can run our script -if [[ $EUID -ne 0 ]]; then - echo "This script must be run as root" 1>&2 - exit 1 -fi - -echo -e "\n\e[34mInstallation of MOTDs32 in progress... \e[0m\n\n" - -## Install command in bashrc - -#echo -ne '\e[0m # (5%)\r' -#sleep 1 -#echo -e "\n\n" - -if [ `grep -c /etc/motd /root/.bashrc` == 0 ] -then - echo -e " code bash missing" -echo "cat /etc/motd" >> /root/.bashrc -echo -e "\e[92m - Code bash \e[0madded.\n" -else -grepmot=`grep '/etc/motd' /root/.bashrc` - echo -e " \e[1;30m Code bash found: \e[0m>>\e[0m $grepmot \e[0m<<\n" - echo -e " -->\e[34m Code bash: \e[92mOK\e[0m" -#sed -i '/cat \/etc\/motd/d' /root/.bashrc -#echo -e "\e[92m Code .bashrc remove.\e[0m" -fi - -## Insdtall modules - - -# Check if MOTDs32 is already add -if [ -f "/etc/motds32/Stats32" ] - then - echo -e " -->\e[34m Stats32 \e[92mFOUND\e[0m" - else - mkdir /etc/motds32; - cp Stats32 /etc/motds32/Stats32 -Rf - echo -e " -->\e[34m Stats32 \e[92mINSTALLED\e[0m" -fi +EOFMO +echo -e "\033[1;30m # MOTDs32 is dynamicaly refreshing the /etc/motd file with current informations" +echo -e "\033[1;30m # about system status and usage." +echo -e "\n \e[34m Installation of MOTDs32 in progress... \e[0m\n\n" # Check files -echo -e " -->\e[34m Check files:\n" -#echo -ne '\e[0m #########(50%)\r' -#sleep 1 -#echo -ne "\n" -command -v figlet >/dev/null 2>&1 || { echo >&2 "Figlet is not installed."; } -command -v ntpd >/dev/null 2>&1 || { echo >&2 "ntp is not installed."; } -command -v make >/dev/null 2>&1 || { echo >&2 "build-essential is not installed."; } -echo -e "\n\e[92m" -echo -e "\nDo you wish to install the required package?\n \e[0m --> apt-get install ntp figlet build-essential ? (y/n) " -old_stty_cfg=$(stty -g) -stty raw -echo -answer=$( while ! head -c 1 | grep -i '[ny]' ;do true ;done ) -stty $old_stty_cfg -if echo "$answer" | grep -iq "^y" ;then - echo -e "\n\e[34m - apt-get install ntp figlet build-essential \e[0m>>\e[92m starting\e[0m\n" ; apt-get install -y build-essential ntp figlet; - echo -e "\n\e[34m - apt-get installation \e[0m>> Succesfull\n" +#echo -e " -->\e[34m Check files:" +if hash figlet 2>/dev/null; then +echo -e " \e[34m- Figlet \e[32minstalled.\e[0m" + else +echo -e " \e[34m- Figlet \e[1;31mis not installed.\e[0m" + fi +if hash ntpd 2>/dev/null; then +echo -e " \e[34m- NTP \e[32minstalled.\e[0m" + else +echo -e " \e[34m- NTP \e[1;31mis not installed.\e[0m" + fi +if hash make 2>/dev/null; then +echo -e " \e[34m- build-essential \e[32minstalled.\e[0m" + else +echo -e " \e[34m- build-essential \e[1;31mis not installed.\e[0m" + fi +echo -e "\n YOU CAN SKIP auto install if you want" +echo -e "\n\e[92m Please Select:" +echo -e " 1. \e[0m(auto)Install Missing Package\e[92m" +echo -e " 2. \e[0mContinue installation script\e[92m" +echo -e " 0. \e[0mQuit\n \e[0m" +read -p " Enter selection [0-2] > " selection + +# Clear area beneath menu +tput cup 10 0 +echo -n ${BG_BLACK}${FG_GREEN} +tput ed +tput cup 11 0 + + # Act on selection + case $selection in + 1) echo -e " \e[32m install missing package ...\e[0m\n" + apt-get install -y build-essential ntp figlet + echo -e "\n\e[34m - apt-get installation build-essential ntp figlet \e[0m>> Succesfull" if [ -f "/usr/bin/motds32" ] then echo -e "\n\e[34m - Make file \e[0m>> already done.\e[0m\n" - else + else echo -e "\n\e[92m -Building binary \e[0m\n" make install echo -e "\n\e[34m - Make file done.\e[0m\n" fi -else -echo -e "\n\e[34mDo you want to continue this installation? (y/n)\n " -old2_stty_cfg=$(stty -g) -stty raw -echo -answer2=$( while ! head -c 2 | grep -i '[ny]' ;do true ;done ) -stty $old2_stty_cfg - if echo "$answer2" | grep -iq "^y" ;then - echo -e "\n\e[34m - NO apt-get required\e[0m Installation continue... \n"; - if [ -f "/usr/bin/motds32" ] - then - echo -e "\n\e[34m - Make file \e[0m>> Succesfull\n" - else - echo -e "\n\e[94m -Building binary \e[0m\n" - make install - echo -e "\n\e[34m - Make file done.\e[0m\n" - fi - else - exit 1 - fi -fi -#command -v figlet >/dev/null 2>&1 || { echo >&2 "Figlet is not installed."; echo "need to install figlet /y"; } -if [ -f "/usr/share/figlet" ] - then - echo -e " -->\e[31m figlet not FOUND\e[0m" - else - cp -Rf fonts/chunky.flf /usr/share/figlet/ - echo -e " -->\e[34m Font figlet \e[92mOK\e[0m" -fi + echo -e "\e[92m" + if [ `grep -c /etc/motd /root/.bashrc` == 0 ] + then + echo -e " \e[1;31m code bash missing" + echo "cat /etc/motd" >> /root/.bashrc + echo -e "\e[92m - Code bash \e[0madded.\n" + else + grepmot=`grep '/etc/motd' /root/.bashrc` + echo -e " \e[1;30m Code bash found: \e[0m>>\e[0m $grepmot \e[0m<<\n" + echo -e " -->\e[34m Code bash: \e[92mOK\e[0m" + #sed -i '/cat \/etc\/motd/d' /root/.bashrc + #echo -e "\e[92m Code .bashrc remove.\e[0m" + fi -# Check motd -if [ -f "/usr/bin/motd" ] - then - echo -e " -->\e[34m motd check \e[92mOK\e[0m\n" - else - ln -s /usr/bin/motds32 /usr/bin/motd - echo -e " -->\e[34m motd bin \e[92mOK\e[0m\n" -fi + # Check if MOTDs32 is already add + if [ -f "/etc/motds32/Stats32" ] + then + echo -e " -->\e[34m Stats32 \e[92mFOUND\e[0m" + else + mkdir /etc/motds32; + cp Stats32 /etc/motds32/Stats32 -Rf + echo -e " -->\e[34m Stats32 \e[92mINSTALLED\e[0m" + fi + # Copy font figlet + if [ -f "/usr/share/figlet" ] + then + echo -e " -->\e[31m figlet not FOUND\e[0m" + else + cp -Rf fonts/chunky.flf /usr/share/figlet/ + echo -e " -->\e[34m Font figlet \e[92mOK\e[0m" + fi -#echo -ne '\e[0m ##################(90%)\r' -#sleep 1 -#echo -e "\n" + # Check if motd is installed correctly + if [ -f "/usr/bin/motd" ] + then + echo -e " -->\e[34m motd check \e[92mOK\e[0m\n" + else + ln -s /usr/bin/motds32 /usr/bin/motd + echo -e " -->\e[34m motd bin \e[92mOK\e[0m\n" + fi + ## Install Crontab + if crontab -l | grep -q '/usr/bin/motds32'; then + echo -e "\e[34m - Cron \e[0m>> already added.\e[0m" + else + echo -e "\e[34m - Cron added.\e[0m" + (crontab -l ; echo "*/5 * * * * /usr/bin/motds32 -g 2>1")| crontab - + fi +## Generate first stats + /usr/bin/motds32 -g + echo -e "\n\n\e[34m \e[92m Installation of MOTDs32 completed!\e[0m \n\n\n Help? Use: \n \033[1;30m /usr/bin/motds32\e[0m \n or \033[1;30m\n motd\e[0m\n" + printf "\n \e[1;33m (Press any key to exit.)\e[0m" + read -n 1 +echo "Installation MOTDs32 terminated." +exit 1 +# Restore screen +tput rmcup + ;; + 2) echo -e "\n\e[92m" + if [ `grep -c /etc/motd /root/.bashrc` == 0 ] + then + echo -e " code bash missing" + echo "cat /etc/motd" >> /root/.bashrc + echo -e "\e[92m - Code bash \e[0madded.\n" + else + grepmot=`grep '/etc/motd' /root/.bashrc` + echo -e " \e[1;30m Code bash found: \e[0m>>\e[0m $grepmot \e[0m<<\n" + echo -e " -->\e[34m Code bash: \e[92mOK\e[0m" + #sed -i '/cat \/etc\/motd/d' /root/.bashrc + #echo -e "\e[92m Code .bashrc remove.\e[0m" + fi -## Install Crontab + # Check if MOTDs32 is already add + if [ -f "/etc/motds32/Stats32" ] + then + echo -e " -->\e[34m Stats32 \e[92mFOUND\e[0m" + else + mkdir /etc/motds32; + cp Stats32 /etc/motds32/Stats32 -Rf + echo -e " -->\e[34m Stats32 \e[92mINSTALLED\e[0m" + fi -if crontab -l | grep -q '/usr/bin/motds32'; then -echo -e "\e[34m - Cron \e[0m>> already added.\e[0m" -else -echo -e "\e[34m - Cron added.\e[0m" -(crontab -l ; echo "*/5 * * * * /usr/bin/motds32 -g 2>1")| crontab - -fi - - + # Copy font figlet + if [ -f "/usr/share/figlet" ] + then + echo -e " -->\e[31m figlet not FOUND\e[0m" + else + cp -Rf fonts/chunky.flf /usr/share/figlet/ + echo -e " -->\e[34m Font figlet \e[92mOK\e[0m" + fi + + # Check if motd ins talled correctly + if [ -f "/usr/bin/motd" ] + then + echo -e " -->\e[34m motd check \e[92mOK\e[0m\n" + else + ln -s /usr/bin/motds32 /usr/bin/motd + echo -e " -->\e[34m motd bin \e[92mOK\e[0m\n" + fi + + ## Install Crontab + if crontab -l | grep -q '/usr/bin/motds32'; then + echo -e "\e[34m - Cron \e[0m>> already added.\e[0m" + else + echo -e "\e[34m - Cron added.\e[0m" + (crontab -l ; echo "*/5 * * * * /usr/bin/motds32 -g 2>1")| crontab - + fi +## Generate first stats + /usr/bin/motds32 -g + echo -e "\n\n\e[34m \e[92m Installation of MOTDs32 completed!\e[0m \n\n\n Help? Use: \n \033[1;30m /usr/bin/motds32\e[0m \n or \033[1;30m\n motd\e[0m\n" + printf "\n \e[1;33m (Press any key to exit.)\e[0m" + read -n 1 + echo "Installation MOTDs32 terminated." +exit 1 +# Restore screen +tput rmcup + ;; + 0) break + ;; + *) break + ;; + esac ## Generate first stats -/usr/bin/motds32 -g + /usr/bin/motds32 -g -#echo -ne '\n\e[0m #######################(100%)\r\n\n' -echo -e "\n\n\e[34m \e[92m Installation of MOTDs32 completed!\n\n" -echo -e "----------------------------------------------------------\e[0m" -echo -e "\n Help? Use: \n \033[1;30m /usr/bin/motds32\e[0m \n or \033[1;30m\n motd\e[0m\n" - -exit 0 -#EOF + echo -e "\n\n\e[34m \e[92m Installation of MOTDs32 completed!\e[0m \n\n\n Help? Use: \n \033[1;30m /usr/bin/motds32\e[0m \n or \033[1;30m\n motd\e[0m\n" + printf "\n \e[1;33m (Press any key to exit.)\e[0m" + read -n 1 +done + +# Restore screen +tput rmcup +echo "Installation MOTDs32 terminated." From 19ed1146e6de9e0df08fffb7c38d1bc673f44fae Mon Sep 17 00:00:00 2001 From: Erreur32 Date: Sun, 30 Jul 2017 22:40:45 +0200 Subject: [PATCH 3/9] Update README.md --- README.md | 167 +++++++++++++++++++++++++++--------------------------- 1 file changed, 83 insertions(+), 84 deletions(-) diff --git a/README.md b/README.md index 3fa8c3a..4e91711 100644 --- a/README.md +++ b/README.md @@ -20,101 +20,108 @@ ``` +- [Features](#features) +- [Requirements](#requirements) +- [Install](#install) +- [Sample MOTD32 report](#Sample MOTD32 report) +- [Documentation](#documentation) +- [Stats Repo](#Stats Repo) +- [License](#license) - -

-

-

MOTDs32 Documentation:

-

Original project: -http://www.gelogic.net/

-

MOTDs32 is a fork of the excelent MOTDstat !

-

Usage: generate dynamicaly the /etc/motd file with current information about system resources and usage

-

Using crontab the script will periodically display status of system resources and services.

-

The original message of the day is now stored in /etc/motd.orig file.

-

Everytime you connect throught the SSH you will see some informations (customisable).

- -

See example

-
+Features +-------- + - Add stats in SSH connection or in the shell +Requirements +------------ +- SHELL >= bash: 4.3.30(1) + +[Original project](http://www.gelogic.net/) + + +MOTDs32 is a fork of the excelent MOTDstat ! + +Usage: generate dynamicaly the /etc/motd file with current information about system resources and usage + +Using crontab the script will periodically display status of system resources and services. + +The original message of the day is now stored in /etc/motd.orig file. + +Everytime you connect throught the SSH you will see some informations (customisable). + -

INSTALLATION:

- -(See INSTALL file.)

-

git clone https://gitlab.echosystem.fr/Erreur32/MOTDs32.git

+Install +-------- +(See [install](https://gitlab.echosystem.fr/Erreur32/MOTDs32/blob/master/INSTALL) file.) -

type inside the directory:

+ type inside the directory: + +```bash +$ ./install.sh +``` +Answer: y (install the package if needed) -./install.sh -

Answer: y (install the package needed)

- If you want some help, try this command: /usr/bin/motds32 or -motd - -
motd
+
+motd
+
+```bash
+$  motd
 Usage: motds32 OPTIONS
     -g, --generate    Check system status and generate it to /etc/motd file
     -s, --status      Show limited content of MOTD file
     -v, --version     Display information about motds32 version and author
     -m, --MotD32      See the MOTD file
-
+``` You can see the result with : +```bash +$ cat /etc/motd +``` -cat /etc/motd -
or -usr/bin/motds32 -c -
or -motd -m

+or +```bash +$ usr/bin/motds32 -c +``` +or +``` +$ motd -m +``` -

You can set differents features in /etc/motds32/motds32.conf

+#You can set differents features in /etc/motds32/motds32.conf -

-

UPDATE:

+UPDATE: + ---- need to redownload the last version form gitlab, do the following: -
git clone https://gitlab.echosystem.fr/Erreur32/MOTDs32.git
-cd MOTDs32
-./uninstall.sh
-git pull
-./install.sh
-
- -## Stats Repo: +```bash +$ git clone https://gitlab.echosystem.fr/Erreur32/MOTDs32.git +$ cd MOTDs32 +$ ./uninstall.sh +$ git pull +$ ./install.sh +``` + +Stats Repo: +------ - https://echosystem.fr/MOTDs32 - https://echosystem.fr/MOTDs32/32.html - https://echosystem.fr/MOTDs32/Stats/index.html -
-

Sample MOTD32 report

-
00:03:47 19/07  @echosystem .../Stats-tools/MOTDs32 (master)# /usr/bin/motds32 -c
+Sample  MOTD32 report
+------
+```bash
+$  /usr/bin/motds32 -c
+```
  
 --------------------------------------------------
 
- motd -m
+```bash
+$ motd -m
 Read motds32 file
         echosystem.fr  > status at 10:05 > 5min load is 0.82 on 8 cpu(s)
 
@@ -156,11 +163,12 @@ Local Users :   2       Processes:      282
 -----------     ---     ------------    ----------
 
   vendredi 21 juillet 2017, 10:05:39 (UTC+0200)
+```
 
-

Explanation of the report

-
Explanation of the report
--------------------------
+Explanation of the report
+-----
 
+```bash
    system hostname              report time        system load
          |                          |                   |
          |      NTP status          |                   |  Number of CPU(s)
@@ -168,19 +176,10 @@ Local Users :   2       Processes:      282
          V         V                V                   V      V                  
     echosystem.fr+-+  > status at 00:03 > 5min load is 0.75 on 8 cpu(s)
- -View on terminal screen the resultat: -... - -

Author

-original project: https://bitbucket.org/hetii/motdstat.git

-
-

🅴🆁🆁🅴🆄🆁32

-
-
-

Hosted on

-
-
+``` + +Powered by 🅴🆁🆁🅴🆄🆁32 +

🅴🅲🅷🔵🆂🆈🆂🆃🅴🅼

-
- \ No newline at end of file + + \ No newline at end of file From f7eb734e2ef5c7bccd2b81d596bf9f87a1cf88a5 Mon Sep 17 00:00:00 2001 From: Erreur32 Date: Sun, 30 Jul 2017 23:02:51 +0200 Subject: [PATCH 4/9] Add new file --- install.sh | 1 + 1 file changed, 1 insertion(+) create mode 100644 install.sh diff --git a/install.sh b/install.sh new file mode 100644 index 0000000..fe1f449 --- /dev/null +++ b/install.sh @@ -0,0 +1 @@ +awd \ No newline at end of file From f3c2d307a58a1e3952139834afb22979af707177 Mon Sep 17 00:00:00 2001 From: Erreur32 Date: Sun, 30 Jul 2017 23:03:53 +0200 Subject: [PATCH 5/9] Update install.sh --- install.sh | 250 ++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 249 insertions(+), 1 deletion(-) diff --git a/install.sh b/install.sh index fe1f449..3390f1a 100644 --- a/install.sh +++ b/install.sh @@ -1 +1,249 @@ -awd \ No newline at end of file +#!/bin/sh +# +# MOTDs32 installation instructions +# ================================== +# +# (2017) New project MOTDs32 Customized by Erreur32 +# Version 0.0.5 +# +# https://gitlab.echosystem.fr/Erreur32/MOTDs32 +# +# ,--. ,--. ,-----. ,--------.,------. ,----. ,---. +# | `.' |' .-. ''--. .--'| .-. \ ,---. '.-. |'.-. \ +# | |'.'| || | | | | | | | \ :( .-' .' < .-' .' +# | | | |' '-' ' | | | '--' /.-' `)/'-' |/ '-. +# `--' `--' `-----' `--' `-------' `----' `----' '-----' +# +# | + Stats32 | +# +# MOTDstat is dynamicaly refreshing the /etc/motd file with current informations +# about system status and usage. +# +# Copyright 2017 🅴🆁🆁🅴🆄🆁32 +# original project: Pavol Krigler +# +# make sur this file is executable +x +################################################################################ +# +# Installation +# ============ +# +# As root execute this command (the easy way!): +# +# ./install.sh +# +################################################################################ +# Make sure only root can run our script +if [[ $EUID -ne 0 ]]; then + echo "This script must be run as root" 1>&2 + exit 1 +fi + +## clean terminal +#clear; +BG_BLUE="$(tput setab 4)" +BG_BLACK="$(tput setab 0)" +FG_GREEN="$(tput setaf 2)" +FG_WHITE="$(tput setaf 7)" +# Save screen +tput smcup +# Display menu until selection == 0 +while [[ $REPLY != 0 ]]; do +echo -n ${BG_BLACK}${FG_WHITE} +clear +cat <<- "EOFMO" + + Installation of MOTDs32 | + Stats32 | + + ,--. ,--. ,-----. ,--------.,------. ,----. ,---. + | `.' |' .-. ''--. .--'| .-. \ ,---. '.-. |'.-. \ + | |'.'| || | | | | | | | \ :( .-' .' ; .-' .' + | | | |' '-' ' | | | '--' /.-' `)/'-' |/ '-. + `--' `--' `-----' `--' `-------' `----' `----' '-----' + + By Erreur32 + +EOFMO +echo -e "\033[1;30m # MOTDs32 is dynamicaly refreshing the /etc/motd file with current informations" +echo -e "\033[1;30m # about system status and usage." +echo -e "\n \e[34m Installation of MOTDs32 in progress... \e[0m\n\n" + +# Check files +#echo -e " -->\e[34m Check files:" +if hash figlet 2>/dev/null; then +echo -e " \e[34m- Figlet \e[32minstalled.\e[0m" + else +echo -e " \e[34m- Figlet \e[1;31mis not installed.\e[0m" + fi +if hash ntpd 2>/dev/null; then +echo -e " \e[34m- NTP \e[32minstalled.\e[0m" + else +echo -e " \e[34m- NTP \e[1;31mis not installed.\e[0m" + fi +if hash make 2>/dev/null; then +echo -e " \e[34m- build-essential \e[32minstalled.\e[0m" + else +echo -e " \e[34m- build-essential \e[1;31mis not installed.\e[0m" + fi +echo -e "\n YOU CAN SKIP auto install if you want" +echo -e "\n\e[92m Please Select:" +echo -e " 1. \e[0m(auto)Install Missing Package\e[92m" +echo -e " 2. \e[0mContinue installation script\e[92m" +echo -e " 0. \e[0mQuit\n \e[0m" +read -p " Enter selection [0-2] > " selection + +# Clear area beneath menu +tput cup 10 0 +echo -n ${BG_BLACK}${FG_GREEN} +tput ed +tput cup 11 0 + + # Act on selection + case $selection in + 1) echo -e " \e[32m install missing package ...\e[0m\n" + apt-get install -y build-essential ntp figlet + echo -e "\n\e[34m - apt-get installation build-essential ntp figlet \e[0m>> Succesfull" + if [ -f "/usr/bin/motds32" ] + then + echo -e "\n\e[34m - Make file \e[0m>> already done.\e[0m\n" + else + echo -e "\n\e[92m -Building binary \e[0m\n" + make install + echo -e "\n\e[34m - Make file done.\e[0m\n" + fi + + echo -e "\e[92m" + if [ `grep -c /etc/motd /root/.bashrc` == 0 ] + then + echo -e " \e[1;31m code bash missing" + echo "cat /etc/motd" >> /root/.bashrc + echo -e "\e[92m - Code bash \e[0madded.\n" + else + grepmot=`grep '/etc/motd' /root/.bashrc` + echo -e " \e[1;30m Code bash found: \e[0m>>\e[0m $grepmot \e[0m<<\n" + echo -e " -->\e[34m Code bash: \e[92mOK\e[0m" + #sed -i '/cat \/etc\/motd/d' /root/.bashrc + #echo -e "\e[92m Code .bashrc remove.\e[0m" + fi + + # Check if MOTDs32 is already add + if [ -f "/etc/motds32/Stats32" ] + then + echo -e " -->\e[34m Stats32 \e[92mFOUND\e[0m" + else + mkdir /etc/motds32; + cp Stats32 /etc/motds32/Stats32 -Rf + echo -e " -->\e[34m Stats32 \e[92mINSTALLED\e[0m" + fi + + # Copy font figlet + if [ -f "/usr/share/figlet" ] + then + echo -e " -->\e[31m figlet not FOUND\e[0m" + else + cp -Rf fonts/chunky.flf /usr/share/figlet/ + echo -e " -->\e[34m Font figlet \e[92mOK\e[0m" + fi + + # Check if motd is installed correctly + if [ -f "/usr/bin/motd" ] + then + echo -e " -->\e[34m motd check \e[92mOK\e[0m\n" + else + ln -s /usr/bin/motds32 /usr/bin/motd + echo -e " -->\e[34m motd bin \e[92mOK\e[0m\n" + fi + ## Install Crontab + if crontab -l | grep -q '/usr/bin/motds32'; then + echo -e "\e[34m - Cron \e[0m>> already added.\e[0m" + else + echo -e "\e[34m - Cron added.\e[0m" + (crontab -l ; echo "*/5 * * * * /usr/bin/motds32 -g 2>1")| crontab - + fi +## Generate first stats + /usr/bin/motds32 -g + + echo -e "\n\n\e[34m \e[92m Installation of MOTDs32 completed!\e[0m \n\n\n Help? Use: \n \033[1;30m /usr/bin/motds32\e[0m \n or \033[1;30m\n motd\e[0m\n" + printf "\n \e[1;33m (Press any key to exit.)\e[0m" + read -n 1 +echo "Installation MOTDs32 terminated." +exit 1 +# Restore screen +tput rmcup + ;; + 2) echo -e "\n\e[92m" + if [ `grep -c /etc/motd /root/.bashrc` == 0 ] + then + echo -e " code bash missing" + echo "cat /etc/motd" >> /root/.bashrc + echo -e "\e[92m - Code bash \e[0madded.\n" + else + grepmot=`grep '/etc/motd' /root/.bashrc` + echo -e " \e[1;30m Code bash found: \e[0m>>\e[0m $grepmot \e[0m<<\n" + echo -e " -->\e[34m Code bash: \e[92mOK\e[0m" + #sed -i '/cat \/etc\/motd/d' /root/.bashrc + #echo -e "\e[92m Code .bashrc remove.\e[0m" + fi + + # Check if MOTDs32 is already add + if [ -f "/etc/motds32/Stats32" ] + then + echo -e " -->\e[34m Stats32 \e[92mFOUND\e[0m" + else + mkdir /etc/motds32; + cp Stats32 /etc/motds32/Stats32 -Rf + echo -e " -->\e[34m Stats32 \e[92mINSTALLED\e[0m" + fi + + # Copy font figlet + if [ -f "/usr/share/figlet" ] + then + echo -e " -->\e[31m figlet not FOUND\e[0m" + else + cp -Rf fonts/chunky.flf /usr/share/figlet/ + echo -e " -->\e[34m Font figlet \e[92mOK\e[0m" + fi + + # Check if motd ins talled correctly + if [ -f "/usr/bin/motd" ] + then + echo -e " -->\e[34m motd check \e[92mOK\e[0m\n" + else + ln -s /usr/bin/motds32 /usr/bin/motd + echo -e " -->\e[34m motd bin \e[92mOK\e[0m\n" + fi + + ## Install Crontab + if crontab -l | grep -q '/usr/bin/motds32'; then + echo -e "\e[34m - Cron \e[0m>> already added.\e[0m" + else + echo -e "\e[34m - Cron added.\e[0m" + (crontab -l ; echo "*/5 * * * * /usr/bin/motds32 -g 2>1")| crontab - + fi +## Generate first stats + /usr/bin/motds32 -g + echo -e "\n\n\e[34m \e[92m Installation of MOTDs32 completed!\e[0m \n\n\n Help? Use: \n \033[1;30m /usr/bin/motds32\e[0m \n or \033[1;30m\n motd\e[0m\n" + printf "\n \e[1;33m (Press any key to exit.)\e[0m" + read -n 1 + echo "Installation MOTDs32 terminated." +exit 1 +# Restore screen +tput rmcup + ;; + 0) break + ;; + *) break + ;; + esac + +## Generate first stats + /usr/bin/motds32 -g + + echo -e "\n\n\e[34m \e[92m Installation of MOTDs32 completed!\e[0m \n\n\n Help? Use: \n \033[1;30m /usr/bin/motds32\e[0m \n or \033[1;30m\n motd\e[0m\n" + printf "\n \e[1;33m (Press any key to exit.)\e[0m" + read -n 1 +done + +# Restore screen +tput rmcup +echo "Installation MOTDs32 terminated." From 97d84780caf7e019bcd66dfcd1c08ff192874c66 Mon Sep 17 00:00:00 2001 From: Erreur32 Date: Sun, 30 Jul 2017 23:05:36 +0200 Subject: [PATCH 6/9] Update install.sh --- install.sh => install2.sh | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename install.sh => install2.sh (100%) diff --git a/install.sh b/install2.sh similarity index 100% rename from install.sh rename to install2.sh From 0f670266a7fb322eb4376d0accdc00df16af0777 Mon Sep 17 00:00:00 2001 From: Erreur32 Date: Sun, 30 Jul 2017 23:07:02 +0200 Subject: [PATCH 7/9] Update install-old.sh --- install-old.sh => install3.sh | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename install-old.sh => install3.sh (100%) diff --git a/install-old.sh b/install3.sh similarity index 100% rename from install-old.sh rename to install3.sh From ffb30e48f4c73418270715495b01d383aeba732b Mon Sep 17 00:00:00 2001 From: Erreur32 Date: Sun, 30 Jul 2017 23:13:48 +0200 Subject: [PATCH 8/9] Delete install3.sh --- install3.sh | 249 ---------------------------------------------------- 1 file changed, 249 deletions(-) delete mode 100755 install3.sh diff --git a/install3.sh b/install3.sh deleted file mode 100755 index 3390f1a..0000000 --- a/install3.sh +++ /dev/null @@ -1,249 +0,0 @@ -#!/bin/sh -# -# MOTDs32 installation instructions -# ================================== -# -# (2017) New project MOTDs32 Customized by Erreur32 -# Version 0.0.5 -# -# https://gitlab.echosystem.fr/Erreur32/MOTDs32 -# -# ,--. ,--. ,-----. ,--------.,------. ,----. ,---. -# | `.' |' .-. ''--. .--'| .-. \ ,---. '.-. |'.-. \ -# | |'.'| || | | | | | | | \ :( .-' .' < .-' .' -# | | | |' '-' ' | | | '--' /.-' `)/'-' |/ '-. -# `--' `--' `-----' `--' `-------' `----' `----' '-----' -# -# | + Stats32 | -# -# MOTDstat is dynamicaly refreshing the /etc/motd file with current informations -# about system status and usage. -# -# Copyright 2017 🅴🆁🆁🅴🆄🆁32 -# original project: Pavol Krigler -# -# make sur this file is executable +x -################################################################################ -# -# Installation -# ============ -# -# As root execute this command (the easy way!): -# -# ./install.sh -# -################################################################################ -# Make sure only root can run our script -if [[ $EUID -ne 0 ]]; then - echo "This script must be run as root" 1>&2 - exit 1 -fi - -## clean terminal -#clear; -BG_BLUE="$(tput setab 4)" -BG_BLACK="$(tput setab 0)" -FG_GREEN="$(tput setaf 2)" -FG_WHITE="$(tput setaf 7)" -# Save screen -tput smcup -# Display menu until selection == 0 -while [[ $REPLY != 0 ]]; do -echo -n ${BG_BLACK}${FG_WHITE} -clear -cat <<- "EOFMO" - - Installation of MOTDs32 | + Stats32 | - - ,--. ,--. ,-----. ,--------.,------. ,----. ,---. - | `.' |' .-. ''--. .--'| .-. \ ,---. '.-. |'.-. \ - | |'.'| || | | | | | | | \ :( .-' .' ; .-' .' - | | | |' '-' ' | | | '--' /.-' `)/'-' |/ '-. - `--' `--' `-----' `--' `-------' `----' `----' '-----' - - By Erreur32 - -EOFMO -echo -e "\033[1;30m # MOTDs32 is dynamicaly refreshing the /etc/motd file with current informations" -echo -e "\033[1;30m # about system status and usage." -echo -e "\n \e[34m Installation of MOTDs32 in progress... \e[0m\n\n" - -# Check files -#echo -e " -->\e[34m Check files:" -if hash figlet 2>/dev/null; then -echo -e " \e[34m- Figlet \e[32minstalled.\e[0m" - else -echo -e " \e[34m- Figlet \e[1;31mis not installed.\e[0m" - fi -if hash ntpd 2>/dev/null; then -echo -e " \e[34m- NTP \e[32minstalled.\e[0m" - else -echo -e " \e[34m- NTP \e[1;31mis not installed.\e[0m" - fi -if hash make 2>/dev/null; then -echo -e " \e[34m- build-essential \e[32minstalled.\e[0m" - else -echo -e " \e[34m- build-essential \e[1;31mis not installed.\e[0m" - fi -echo -e "\n YOU CAN SKIP auto install if you want" -echo -e "\n\e[92m Please Select:" -echo -e " 1. \e[0m(auto)Install Missing Package\e[92m" -echo -e " 2. \e[0mContinue installation script\e[92m" -echo -e " 0. \e[0mQuit\n \e[0m" -read -p " Enter selection [0-2] > " selection - -# Clear area beneath menu -tput cup 10 0 -echo -n ${BG_BLACK}${FG_GREEN} -tput ed -tput cup 11 0 - - # Act on selection - case $selection in - 1) echo -e " \e[32m install missing package ...\e[0m\n" - apt-get install -y build-essential ntp figlet - echo -e "\n\e[34m - apt-get installation build-essential ntp figlet \e[0m>> Succesfull" - if [ -f "/usr/bin/motds32" ] - then - echo -e "\n\e[34m - Make file \e[0m>> already done.\e[0m\n" - else - echo -e "\n\e[92m -Building binary \e[0m\n" - make install - echo -e "\n\e[34m - Make file done.\e[0m\n" - fi - - echo -e "\e[92m" - if [ `grep -c /etc/motd /root/.bashrc` == 0 ] - then - echo -e " \e[1;31m code bash missing" - echo "cat /etc/motd" >> /root/.bashrc - echo -e "\e[92m - Code bash \e[0madded.\n" - else - grepmot=`grep '/etc/motd' /root/.bashrc` - echo -e " \e[1;30m Code bash found: \e[0m>>\e[0m $grepmot \e[0m<<\n" - echo -e " -->\e[34m Code bash: \e[92mOK\e[0m" - #sed -i '/cat \/etc\/motd/d' /root/.bashrc - #echo -e "\e[92m Code .bashrc remove.\e[0m" - fi - - # Check if MOTDs32 is already add - if [ -f "/etc/motds32/Stats32" ] - then - echo -e " -->\e[34m Stats32 \e[92mFOUND\e[0m" - else - mkdir /etc/motds32; - cp Stats32 /etc/motds32/Stats32 -Rf - echo -e " -->\e[34m Stats32 \e[92mINSTALLED\e[0m" - fi - - # Copy font figlet - if [ -f "/usr/share/figlet" ] - then - echo -e " -->\e[31m figlet not FOUND\e[0m" - else - cp -Rf fonts/chunky.flf /usr/share/figlet/ - echo -e " -->\e[34m Font figlet \e[92mOK\e[0m" - fi - - # Check if motd is installed correctly - if [ -f "/usr/bin/motd" ] - then - echo -e " -->\e[34m motd check \e[92mOK\e[0m\n" - else - ln -s /usr/bin/motds32 /usr/bin/motd - echo -e " -->\e[34m motd bin \e[92mOK\e[0m\n" - fi - ## Install Crontab - if crontab -l | grep -q '/usr/bin/motds32'; then - echo -e "\e[34m - Cron \e[0m>> already added.\e[0m" - else - echo -e "\e[34m - Cron added.\e[0m" - (crontab -l ; echo "*/5 * * * * /usr/bin/motds32 -g 2>1")| crontab - - fi -## Generate first stats - /usr/bin/motds32 -g - - echo -e "\n\n\e[34m \e[92m Installation of MOTDs32 completed!\e[0m \n\n\n Help? Use: \n \033[1;30m /usr/bin/motds32\e[0m \n or \033[1;30m\n motd\e[0m\n" - printf "\n \e[1;33m (Press any key to exit.)\e[0m" - read -n 1 -echo "Installation MOTDs32 terminated." -exit 1 -# Restore screen -tput rmcup - ;; - 2) echo -e "\n\e[92m" - if [ `grep -c /etc/motd /root/.bashrc` == 0 ] - then - echo -e " code bash missing" - echo "cat /etc/motd" >> /root/.bashrc - echo -e "\e[92m - Code bash \e[0madded.\n" - else - grepmot=`grep '/etc/motd' /root/.bashrc` - echo -e " \e[1;30m Code bash found: \e[0m>>\e[0m $grepmot \e[0m<<\n" - echo -e " -->\e[34m Code bash: \e[92mOK\e[0m" - #sed -i '/cat \/etc\/motd/d' /root/.bashrc - #echo -e "\e[92m Code .bashrc remove.\e[0m" - fi - - # Check if MOTDs32 is already add - if [ -f "/etc/motds32/Stats32" ] - then - echo -e " -->\e[34m Stats32 \e[92mFOUND\e[0m" - else - mkdir /etc/motds32; - cp Stats32 /etc/motds32/Stats32 -Rf - echo -e " -->\e[34m Stats32 \e[92mINSTALLED\e[0m" - fi - - # Copy font figlet - if [ -f "/usr/share/figlet" ] - then - echo -e " -->\e[31m figlet not FOUND\e[0m" - else - cp -Rf fonts/chunky.flf /usr/share/figlet/ - echo -e " -->\e[34m Font figlet \e[92mOK\e[0m" - fi - - # Check if motd ins talled correctly - if [ -f "/usr/bin/motd" ] - then - echo -e " -->\e[34m motd check \e[92mOK\e[0m\n" - else - ln -s /usr/bin/motds32 /usr/bin/motd - echo -e " -->\e[34m motd bin \e[92mOK\e[0m\n" - fi - - ## Install Crontab - if crontab -l | grep -q '/usr/bin/motds32'; then - echo -e "\e[34m - Cron \e[0m>> already added.\e[0m" - else - echo -e "\e[34m - Cron added.\e[0m" - (crontab -l ; echo "*/5 * * * * /usr/bin/motds32 -g 2>1")| crontab - - fi -## Generate first stats - /usr/bin/motds32 -g - echo -e "\n\n\e[34m \e[92m Installation of MOTDs32 completed!\e[0m \n\n\n Help? Use: \n \033[1;30m /usr/bin/motds32\e[0m \n or \033[1;30m\n motd\e[0m\n" - printf "\n \e[1;33m (Press any key to exit.)\e[0m" - read -n 1 - echo "Installation MOTDs32 terminated." -exit 1 -# Restore screen -tput rmcup - ;; - 0) break - ;; - *) break - ;; - esac - -## Generate first stats - /usr/bin/motds32 -g - - echo -e "\n\n\e[34m \e[92m Installation of MOTDs32 completed!\e[0m \n\n\n Help? Use: \n \033[1;30m /usr/bin/motds32\e[0m \n or \033[1;30m\n motd\e[0m\n" - printf "\n \e[1;33m (Press any key to exit.)\e[0m" - read -n 1 -done - -# Restore screen -tput rmcup -echo "Installation MOTDs32 terminated." From c732b1ad12bef8f4400b110016a3c55a023a5bd2 Mon Sep 17 00:00:00 2001 From: Erreur32 Date: Sun, 30 Jul 2017 23:13:51 +0200 Subject: [PATCH 9/9] Delete install2.sh --- install2.sh | 249 ---------------------------------------------------- 1 file changed, 249 deletions(-) delete mode 100644 install2.sh diff --git a/install2.sh b/install2.sh deleted file mode 100644 index 3390f1a..0000000 --- a/install2.sh +++ /dev/null @@ -1,249 +0,0 @@ -#!/bin/sh -# -# MOTDs32 installation instructions -# ================================== -# -# (2017) New project MOTDs32 Customized by Erreur32 -# Version 0.0.5 -# -# https://gitlab.echosystem.fr/Erreur32/MOTDs32 -# -# ,--. ,--. ,-----. ,--------.,------. ,----. ,---. -# | `.' |' .-. ''--. .--'| .-. \ ,---. '.-. |'.-. \ -# | |'.'| || | | | | | | | \ :( .-' .' < .-' .' -# | | | |' '-' ' | | | '--' /.-' `)/'-' |/ '-. -# `--' `--' `-----' `--' `-------' `----' `----' '-----' -# -# | + Stats32 | -# -# MOTDstat is dynamicaly refreshing the /etc/motd file with current informations -# about system status and usage. -# -# Copyright 2017 🅴🆁🆁🅴🆄🆁32 -# original project: Pavol Krigler -# -# make sur this file is executable +x -################################################################################ -# -# Installation -# ============ -# -# As root execute this command (the easy way!): -# -# ./install.sh -# -################################################################################ -# Make sure only root can run our script -if [[ $EUID -ne 0 ]]; then - echo "This script must be run as root" 1>&2 - exit 1 -fi - -## clean terminal -#clear; -BG_BLUE="$(tput setab 4)" -BG_BLACK="$(tput setab 0)" -FG_GREEN="$(tput setaf 2)" -FG_WHITE="$(tput setaf 7)" -# Save screen -tput smcup -# Display menu until selection == 0 -while [[ $REPLY != 0 ]]; do -echo -n ${BG_BLACK}${FG_WHITE} -clear -cat <<- "EOFMO" - - Installation of MOTDs32 | + Stats32 | - - ,--. ,--. ,-----. ,--------.,------. ,----. ,---. - | `.' |' .-. ''--. .--'| .-. \ ,---. '.-. |'.-. \ - | |'.'| || | | | | | | | \ :( .-' .' ; .-' .' - | | | |' '-' ' | | | '--' /.-' `)/'-' |/ '-. - `--' `--' `-----' `--' `-------' `----' `----' '-----' - - By Erreur32 - -EOFMO -echo -e "\033[1;30m # MOTDs32 is dynamicaly refreshing the /etc/motd file with current informations" -echo -e "\033[1;30m # about system status and usage." -echo -e "\n \e[34m Installation of MOTDs32 in progress... \e[0m\n\n" - -# Check files -#echo -e " -->\e[34m Check files:" -if hash figlet 2>/dev/null; then -echo -e " \e[34m- Figlet \e[32minstalled.\e[0m" - else -echo -e " \e[34m- Figlet \e[1;31mis not installed.\e[0m" - fi -if hash ntpd 2>/dev/null; then -echo -e " \e[34m- NTP \e[32minstalled.\e[0m" - else -echo -e " \e[34m- NTP \e[1;31mis not installed.\e[0m" - fi -if hash make 2>/dev/null; then -echo -e " \e[34m- build-essential \e[32minstalled.\e[0m" - else -echo -e " \e[34m- build-essential \e[1;31mis not installed.\e[0m" - fi -echo -e "\n YOU CAN SKIP auto install if you want" -echo -e "\n\e[92m Please Select:" -echo -e " 1. \e[0m(auto)Install Missing Package\e[92m" -echo -e " 2. \e[0mContinue installation script\e[92m" -echo -e " 0. \e[0mQuit\n \e[0m" -read -p " Enter selection [0-2] > " selection - -# Clear area beneath menu -tput cup 10 0 -echo -n ${BG_BLACK}${FG_GREEN} -tput ed -tput cup 11 0 - - # Act on selection - case $selection in - 1) echo -e " \e[32m install missing package ...\e[0m\n" - apt-get install -y build-essential ntp figlet - echo -e "\n\e[34m - apt-get installation build-essential ntp figlet \e[0m>> Succesfull" - if [ -f "/usr/bin/motds32" ] - then - echo -e "\n\e[34m - Make file \e[0m>> already done.\e[0m\n" - else - echo -e "\n\e[92m -Building binary \e[0m\n" - make install - echo -e "\n\e[34m - Make file done.\e[0m\n" - fi - - echo -e "\e[92m" - if [ `grep -c /etc/motd /root/.bashrc` == 0 ] - then - echo -e " \e[1;31m code bash missing" - echo "cat /etc/motd" >> /root/.bashrc - echo -e "\e[92m - Code bash \e[0madded.\n" - else - grepmot=`grep '/etc/motd' /root/.bashrc` - echo -e " \e[1;30m Code bash found: \e[0m>>\e[0m $grepmot \e[0m<<\n" - echo -e " -->\e[34m Code bash: \e[92mOK\e[0m" - #sed -i '/cat \/etc\/motd/d' /root/.bashrc - #echo -e "\e[92m Code .bashrc remove.\e[0m" - fi - - # Check if MOTDs32 is already add - if [ -f "/etc/motds32/Stats32" ] - then - echo -e " -->\e[34m Stats32 \e[92mFOUND\e[0m" - else - mkdir /etc/motds32; - cp Stats32 /etc/motds32/Stats32 -Rf - echo -e " -->\e[34m Stats32 \e[92mINSTALLED\e[0m" - fi - - # Copy font figlet - if [ -f "/usr/share/figlet" ] - then - echo -e " -->\e[31m figlet not FOUND\e[0m" - else - cp -Rf fonts/chunky.flf /usr/share/figlet/ - echo -e " -->\e[34m Font figlet \e[92mOK\e[0m" - fi - - # Check if motd is installed correctly - if [ -f "/usr/bin/motd" ] - then - echo -e " -->\e[34m motd check \e[92mOK\e[0m\n" - else - ln -s /usr/bin/motds32 /usr/bin/motd - echo -e " -->\e[34m motd bin \e[92mOK\e[0m\n" - fi - ## Install Crontab - if crontab -l | grep -q '/usr/bin/motds32'; then - echo -e "\e[34m - Cron \e[0m>> already added.\e[0m" - else - echo -e "\e[34m - Cron added.\e[0m" - (crontab -l ; echo "*/5 * * * * /usr/bin/motds32 -g 2>1")| crontab - - fi -## Generate first stats - /usr/bin/motds32 -g - - echo -e "\n\n\e[34m \e[92m Installation of MOTDs32 completed!\e[0m \n\n\n Help? Use: \n \033[1;30m /usr/bin/motds32\e[0m \n or \033[1;30m\n motd\e[0m\n" - printf "\n \e[1;33m (Press any key to exit.)\e[0m" - read -n 1 -echo "Installation MOTDs32 terminated." -exit 1 -# Restore screen -tput rmcup - ;; - 2) echo -e "\n\e[92m" - if [ `grep -c /etc/motd /root/.bashrc` == 0 ] - then - echo -e " code bash missing" - echo "cat /etc/motd" >> /root/.bashrc - echo -e "\e[92m - Code bash \e[0madded.\n" - else - grepmot=`grep '/etc/motd' /root/.bashrc` - echo -e " \e[1;30m Code bash found: \e[0m>>\e[0m $grepmot \e[0m<<\n" - echo -e " -->\e[34m Code bash: \e[92mOK\e[0m" - #sed -i '/cat \/etc\/motd/d' /root/.bashrc - #echo -e "\e[92m Code .bashrc remove.\e[0m" - fi - - # Check if MOTDs32 is already add - if [ -f "/etc/motds32/Stats32" ] - then - echo -e " -->\e[34m Stats32 \e[92mFOUND\e[0m" - else - mkdir /etc/motds32; - cp Stats32 /etc/motds32/Stats32 -Rf - echo -e " -->\e[34m Stats32 \e[92mINSTALLED\e[0m" - fi - - # Copy font figlet - if [ -f "/usr/share/figlet" ] - then - echo -e " -->\e[31m figlet not FOUND\e[0m" - else - cp -Rf fonts/chunky.flf /usr/share/figlet/ - echo -e " -->\e[34m Font figlet \e[92mOK\e[0m" - fi - - # Check if motd ins talled correctly - if [ -f "/usr/bin/motd" ] - then - echo -e " -->\e[34m motd check \e[92mOK\e[0m\n" - else - ln -s /usr/bin/motds32 /usr/bin/motd - echo -e " -->\e[34m motd bin \e[92mOK\e[0m\n" - fi - - ## Install Crontab - if crontab -l | grep -q '/usr/bin/motds32'; then - echo -e "\e[34m - Cron \e[0m>> already added.\e[0m" - else - echo -e "\e[34m - Cron added.\e[0m" - (crontab -l ; echo "*/5 * * * * /usr/bin/motds32 -g 2>1")| crontab - - fi -## Generate first stats - /usr/bin/motds32 -g - echo -e "\n\n\e[34m \e[92m Installation of MOTDs32 completed!\e[0m \n\n\n Help? Use: \n \033[1;30m /usr/bin/motds32\e[0m \n or \033[1;30m\n motd\e[0m\n" - printf "\n \e[1;33m (Press any key to exit.)\e[0m" - read -n 1 - echo "Installation MOTDs32 terminated." -exit 1 -# Restore screen -tput rmcup - ;; - 0) break - ;; - *) break - ;; - esac - -## Generate first stats - /usr/bin/motds32 -g - - echo -e "\n\n\e[34m \e[92m Installation of MOTDs32 completed!\e[0m \n\n\n Help? Use: \n \033[1;30m /usr/bin/motds32\e[0m \n or \033[1;30m\n motd\e[0m\n" - printf "\n \e[1;33m (Press any key to exit.)\e[0m" - read -n 1 -done - -# Restore screen -tput rmcup -echo "Installation MOTDs32 terminated."