first commit
This commit is contained in:
parent
e8bf98654a
commit
535f0adf71
4 changed files with 22 additions and 18 deletions
2
Stats32
2
Stats32
|
@ -40,7 +40,7 @@ ip=`hostname -i | awk '{ printf $1 }'`
|
||||||
printf "Kernel Info [ $DISTRIB_DESCRIPTION ]\n"
|
printf "Kernel Info [ $DISTRIB_DESCRIPTION ]\n"
|
||||||
printf "%s------------\t------\t------------\t--------------\n"
|
printf "%s------------\t------\t------------\t--------------\n"
|
||||||
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 "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 " \t%s \tUptime system \e[33;3m\t%s\e[0;0m\n" " " "$time"
|
printf "Ban IP \e[41m\e[1m\t%s\e[0;0m\tUptime system \e[33;3m\t%s\e[0;0m\n" " $(cat /var/log/banabuseip.log |wc -l ) " "$time"
|
||||||
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 "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 "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"
|
printf "%s------------\t------\t------------\t--------------\n"
|
||||||
|
|
14
bin/motds32
14
bin/motds32
|
@ -90,7 +90,6 @@ $MOTD32 > $PRG32/Stats32.txt
|
||||||
#$stats_data
|
#$stats_data
|
||||||
#$MOTD32 > $PRG32/Stats32.txt
|
#$MOTD32 > $PRG32/Stats32.txt
|
||||||
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# Append message to the report (and to syslog if enabled)
|
# Append message to the report (and to syslog if enabled)
|
||||||
#
|
#
|
||||||
|
@ -562,7 +561,8 @@ function usage {
|
||||||
echo "Usage: motds32 OPTIONS"
|
echo "Usage: motds32 OPTIONS"
|
||||||
|
|
||||||
echo " -g, --generate Check system status and generate it to $MOTD file"
|
echo " -g, --generate Check system status and generate it to $MOTD file"
|
||||||
echo " -s, --status Show limited content of MOTD file"
|
echo " -s, --status Show limited content of MOTDs32 file"
|
||||||
|
echo " -o, --old Show limited content of old MOTD file"
|
||||||
echo " -v, --version Display information about motds32 version and author"
|
echo " -v, --version Display information about motds32 version and author"
|
||||||
echo " -U, --update Update MOTD now!"
|
echo " -U, --update Update MOTD now!"
|
||||||
exit 0
|
exit 0
|
||||||
|
@ -575,6 +575,10 @@ case $1 in
|
||||||
test -e $MOTD && cat $MOTD
|
test -e $MOTD && cat $MOTD
|
||||||
exit 0
|
exit 0
|
||||||
;;
|
;;
|
||||||
|
-o|--old)
|
||||||
|
cat /etc/motd.orig
|
||||||
|
exit 0
|
||||||
|
;;
|
||||||
-v|--version)
|
-v|--version)
|
||||||
echo "motds32 Version: $VERSION"
|
echo "motds32 Version: $VERSION"
|
||||||
echo "Original project: Krigler Pavol, modstat"
|
echo "Original project: Krigler Pavol, modstat"
|
||||||
|
@ -646,11 +650,11 @@ cat /etc/motds32/Stats32.txt >> $MOTD
|
||||||
echo >> $MOTD
|
echo >> $MOTD
|
||||||
|
|
||||||
# Append original MOTD from /etc/motd.orig file if exists
|
# Append original MOTD from /etc/motd.orig file if exists
|
||||||
if [ -s ${MOTD}.orig ]; then
|
#if [ -s ${MOTD}.orig ]; then
|
||||||
# echo_center "--- Message Of The Day --- (from /etc/motd.orig file) ---" >> $MOTD
|
# echo_center "--- Message Of The Day --- (from /etc/motd.orig file) ---" >> $MOTD
|
||||||
# echo >> $MOTD
|
# echo >> $MOTD
|
||||||
cat ${MOTD}.orig >> $MOTD
|
# cat ${MOTD}.orig >> $MOTD
|
||||||
fi
|
#fi
|
||||||
|
|
||||||
# Create statistics directory
|
# Create statistics directory
|
||||||
test ! -e $STATS_DIR && mkdir -p $STATS_DIR
|
test ! -e $STATS_DIR && mkdir -p $STATS_DIR
|
||||||
|
|
20
install.sh
20
install.sh
|
@ -189,8 +189,8 @@ tput cup 11 0
|
||||||
if crontab -l | grep -q '/usr/bin/motds32'; then
|
if crontab -l | grep -q '/usr/bin/motds32'; then
|
||||||
echo -e " \e[34m -Cron \e[0m>> already added.\e[0m"
|
echo -e " \e[34m -Cron \e[0m>> already added.\e[0m"
|
||||||
else
|
else
|
||||||
echo -e "\e[34m - Cron added.\e[0m"
|
(crontab -l ; echo "*/5 * * * * /usr/bin/motds32 -g >/dev/null 2>&1")| crontab -
|
||||||
(crontab -l ; echo "*/5 * * * * /usr/bin/motds32 -g 2>1")| crontab -
|
echo -e "\e[34m - Cron added.\e[0m"
|
||||||
fi
|
fi
|
||||||
## Generate first stats
|
## 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
|
||||||
|
@ -220,7 +220,7 @@ tput cup 11 0
|
||||||
if [ -f "/usr/bin/motds32" ]
|
if [ -f "/usr/bin/motds32" ]
|
||||||
then
|
then
|
||||||
echo -e "\n\e[34m - Make file \e[0m>> found.\e[0m\n"
|
echo -e "\n\e[34m - Make file \e[0m>> found.\e[0m\n"
|
||||||
#make install
|
#make install -- see update
|
||||||
#echo -e "\n\e[34m - REMake file done.\e[0m\n"
|
#echo -e "\n\e[34m - REMake file done.\e[0m\n"
|
||||||
else
|
else
|
||||||
echo -e "\n\e[92m -Building binary \e[0m\n"
|
echo -e "\n\e[92m -Building binary \e[0m\n"
|
||||||
|
@ -260,8 +260,8 @@ tput cup 11 0
|
||||||
echo -e "\e[34m - Cron \e[0m>> already added.\e[0m"
|
echo -e "\e[34m - Cron \e[0m>> already added.\e[0m"
|
||||||
/usr/bin/motds32 -g
|
/usr/bin/motds32 -g
|
||||||
else
|
else
|
||||||
|
(crontab -l ; echo "*/5 * * * * /usr/bin/motds32 -g >/dev/null 2>&1")| crontab -
|
||||||
echo -e "\e[34m - Cron added.\e[0m"
|
echo -e "\e[34m - Cron added.\e[0m"
|
||||||
(crontab -l ; echo "*/5 * * * * /usr/bin/motds32 -g 2>1")| crontab -
|
|
||||||
fi
|
fi
|
||||||
## Generate first stats
|
## 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
|
||||||
|
@ -294,7 +294,7 @@ tput cup 11 0
|
||||||
# motd -g
|
# motd -g
|
||||||
/usr/bin/motds32 -g
|
/usr/bin/motds32 -g
|
||||||
;;
|
;;
|
||||||
4) echo -e "\n\e[34m Unistall of MOTDs32 in progress... \e[0m"
|
4) echo -e "\n\e[34m Unistall of MOTDs32 in progress... \e[0m\n"
|
||||||
## remove file and directory
|
## remove file and directory
|
||||||
make uninstall
|
make uninstall
|
||||||
rm /etc/motds32/ -Rf
|
rm /etc/motds32/ -Rf
|
||||||
|
@ -303,18 +303,18 @@ tput cup 11 0
|
||||||
|
|
||||||
## remove cron
|
## remove cron
|
||||||
if crontab -l | grep -q '/usr/bin/motds32'; then
|
if crontab -l | grep -q '/usr/bin/motds32'; then
|
||||||
echo -e " \e[92m Cron localized\n"
|
echo -e "\n \e[92m Cron localized\n"
|
||||||
crontab -l | grep -v '/usr/bin/motds32 -g 2>1' | crontab -u root -
|
crontab -l | grep -v '*/5 * * * * /usr/bin/motds32 -g >/dev/null 2>&1' | crontab -u root -
|
||||||
echo -e " \e[92m Cron removed\n"
|
echo -e " \e[92m Cron removed\n"
|
||||||
else
|
else
|
||||||
echo -e " \e[93m Cron not find\n"
|
echo -e "\n \e[93m Cron not find\n"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ `grep -c /etc/motd ~/.bashrc` == 0 ]
|
if [ `grep -c /etc/motd ~/.bashrc` == 0 ]
|
||||||
then
|
then
|
||||||
echo " Code bash not found"
|
echo " Code bash removed"
|
||||||
else
|
else
|
||||||
echo " code bash found"
|
echo " Code bash found"
|
||||||
sed -i '/cat \/etc\/motd/d' ~/.bashrc
|
sed -i '/cat \/etc\/motd/d' ~/.bashrc
|
||||||
sed -i '/cat \/usr\/bin\/motds32 -g/d' ~/.bashrc
|
sed -i '/cat \/usr\/bin\/motds32 -g/d' ~/.bashrc
|
||||||
echo -e "\e[92m Code .bashrc removed.\e[0m"
|
echo -e "\e[92m Code .bashrc removed.\e[0m"
|
||||||
|
|
Loading…
Reference in a new issue