first commit
This commit is contained in:
parent
eb7b3caf9b
commit
a524dfb790
3 changed files with 23 additions and 23 deletions
15
Stats32
15
Stats32
|
@ -39,17 +39,14 @@ ip=`hostname -i`
|
|||
# ip=`hostname -i | awk '{ printf $2 }'`
|
||||
printf "Kernel Info [ $DISTRIB_DESCRIPTION ]\n"
|
||||
printf "%s------------\t------\t------------\t--------------\n"
|
||||
printf "System load \e[42;30;1m\t%s\e[0;0m\tIP Address \e[35;1m\t%s\e[0;0m\n" " $load " $ip
|
||||
printf "System load \e[42;30;1m\t%s\e[0;0m\tIP Address \e[0;1m\e[38;5;166m\t%s\e[0;0m\n" " $load " $ip
|
||||
printf "Memory usage \e[46;3m\e[30;1m\t%s\e[0;0m\tUptime system \e[33;3m\t%s\e[0;0m\n" " $memory_usage " "$time"
|
||||
printf "Usage on / \e[46;3m\e[30m\t%s\e[0;0m\tenv LANG \e[33;3m\t%s\e[0;0m\n" " $root_usage " "$(env | grep LANG=)"
|
||||
printf "Swap usage \e[46;3m\e[30m\t%s\e[0;0m\tProcesses \e[35;3m\t%s\e[0;0m\n" " $swap_usage " $processes
|
||||
printf "User SSH \e[41m\e[1m\t%s\e[0;0m\tShell \e[95m\t%s\e[0;0m\n" " $(users | wc -w) " $SHELL
|
||||
printf "Process \t(\e[38;5;166m%s\e[0;0m)\tenv LANG \e[33;3m\t%s\e[0;0m\n" " $processes" "$(env | grep LANG=)"
|
||||
printf "User SSH \e[41m\e[1m\t%s\e[0;0m\tShell \e[33;3m\t%s\e[0;0m\n" " $(users | wc -w) " $SHELL
|
||||
printf "%s------------\t------\t------------\t--------------\n"
|
||||
|
||||
echo -e "\n Conected Users $(users | wc -w) \e[1;30m" ; [[ -z "$nbconnected" ]] && last -a -n $nbconnected | grep pts | head -3 || last -a -n $nbconnected | grep pts | head -3
|
||||
echo -e "\nConected Users $(users | wc -w) \e[3m $(date "+%D %T")\e[0;0m\e[38;5;240m"
|
||||
[[ -z "$nbconnected" ]] && last -a -n $nbconnected | grep pts | head -3 || last -a -n $nbconnected | grep pts | head -3
|
||||
echo -e "\e[0m"
|
||||
#[[ -z "$nbconnected" ]] && echo "Empty" || echo "Not empty"
|
||||
|
||||
|
||||
echo -e "\e[93m Generated by MOTDs32\e[0m"
|
||||
echo -e " Welcome $USER"
|
||||
#echo -n " Welcome " ; whoami
|
||||
|
|
|
@ -564,7 +564,7 @@ function usage {
|
|||
echo " -g, --generate Check system status and generate it to $MOTD file"
|
||||
echo " -s, --status Show limited content of MOTD file"
|
||||
echo " -v, --version Display information about motds32 version and author"
|
||||
echo " -m, --MOTDs32 See MOTD file now!"
|
||||
echo " -U, --update Update MOTD now!"
|
||||
exit 0
|
||||
}
|
||||
|
||||
|
@ -581,9 +581,9 @@ case $1 in
|
|||
echo "MOTDs32: by Erreur32"
|
||||
exit 0
|
||||
;;
|
||||
-m|--MOTDs32)
|
||||
echo "Read motds32 file"
|
||||
cat /etc/motd
|
||||
-U|--update)
|
||||
echo "Update motds32 "
|
||||
git pull
|
||||
exit 0
|
||||
;;
|
||||
*)
|
||||
|
|
23
install.sh
23
install.sh
|
@ -189,20 +189,23 @@ tput cup 11 0
|
|||
(crontab -l ; echo "*/5 * * * * /usr/bin/motds32 -g 2>1")| crontab -
|
||||
fi
|
||||
## Generate first stats
|
||||
if test -f /usr/bin/motds32; then /usr/bin/motds32 -g; fi
|
||||
if test -f /usr/bin/motds32; then /usr/bin/motds32 -g; fi
|
||||
|
||||
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 0 to exit)\e[0m"
|
||||
printf "\n \e[1;33m (Or any key to go back.)\e[0m"
|
||||
;;
|
||||
;;
|
||||
2) echo -n " Git " ; git pull ; echo -e "\n\e[92m" ;
|
||||
if [ `grep -c /etc/motd ~/.bashrc` == 0 ]
|
||||
grepmot="cat /etc/motd"
|
||||
# if [ `grep -c "cat /etc/motd" ~/.bashrc` == 0 ]
|
||||
if [ $(grep -c "cat /etc/motd" ~/.bashrc) == 0 ]
|
||||
then
|
||||
echo -e "\e[31m code bash missing\e[0m"
|
||||
echo "cat /etc/motd" >> ~/.bashrc
|
||||
echo $grepmot >> ~/.bashrc
|
||||
echo -e "\e[92m - Code bash \e[0madded.\n"
|
||||
else
|
||||
grepmot=$(grep "etc/motd" ~/.bashrc)
|
||||
# sed -i '/cat \/etc\/motd/d' ~/.bashrc
|
||||
# grepmot=$(grep "/etc/motd" ~/.bashrc)
|
||||
echo -e " \e[32;1m Code bash found: \e[0m>>\e[0m $grepmot \e[0m<<\n"
|
||||
echo -e " -->\e[34m Code bash: \e[92mOK\e[0m"
|
||||
fi
|
||||
|
@ -224,10 +227,10 @@ if test -f /usr/bin/motds32; then /usr/bin/motds32 -g; fi
|
|||
if [ -f "/etc/motds32/Stats32" ]
|
||||
then
|
||||
echo -e " -->\e[34m Stats32 \e[92mOK\e[0m"
|
||||
cp Stats32 /etc/motds32/Stats32 -f
|
||||
cp -f Stats32 /etc/motds32/Stats32
|
||||
else
|
||||
cp Stats32 /etc/motds32/Stats32 -f
|
||||
echo -e " -->\e[34m Stats32 \e[92mINSTALLED\e[0m"
|
||||
cp -f Stats32 /etc/motds32/Stats32
|
||||
echo -e " -->\e[34m Stats32 \e[92mINSTALLED\e[0m"
|
||||
fi
|
||||
|
||||
# Copy font figlet
|
||||
|
@ -239,7 +242,7 @@ if test -f /usr/bin/motds32; then /usr/bin/motds32 -g; fi
|
|||
echo -e " -->\e[34m figlet&font \e[92mOK\e[0m"
|
||||
fi
|
||||
|
||||
# Check if motd ins talled correctly
|
||||
# Check if motd is installed correctly
|
||||
if [ -f "/usr/bin/motd" ]
|
||||
then
|
||||
echo -e " -->\e[34m motd check \e[92mOK\e[0m\n"
|
||||
|
@ -266,7 +269,7 @@ if test -f /usr/bin/motds32; then /usr/bin/motds32 -g; fi
|
|||
## remove file and directory
|
||||
make uninstall
|
||||
rm /etc/motds32/ -Rf
|
||||
rm /usr/bin/motd -f
|
||||
rm -f /usr/bin/motd
|
||||
rm /var/cache/motds32/ -Rf
|
||||
|
||||
## remove cron
|
||||
|
|
Loading…
Reference in a new issue