Update motds32
This commit is contained in:
parent
7a0647f0a3
commit
cfb0c2feea
1 changed files with 18 additions and 30 deletions
48
bin/motds32
48
bin/motds32
|
@ -1,28 +1,15 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
#
|
#
|
||||||
# Author: Krigler Pavol
|
# MOTDs32 powered by Erreur32
|
||||||
# Version 0.0.4
|
# Original Author: Krigler Pavol
|
||||||
|
# Version 0.0.5
|
||||||
#
|
#
|
||||||
# MOTDs32 is dynamicaly refreshing the /etc/motd file with current informations
|
# MOTDs32 is dynamicaly refreshing the /etc/motd file with current informations
|
||||||
# about system status and usage.
|
# about system status and usage.
|
||||||
#
|
#
|
||||||
# Copyright 2013 Pavol Krigler <pavol.krigler@gelogic.net>
|
# Copyright 2013 Pavol Krigler <pavol.krigler@gelogic.net>
|
||||||
#
|
#
|
||||||
# This file is part of MOTDs32.
|
|
||||||
#
|
|
||||||
# MOTDs32 is free software: you can redistribute it and/or modify
|
|
||||||
# it under the terms of the GNU General Public License as published by
|
|
||||||
# the Free Software Foundation, either version 3 of the License, or
|
|
||||||
# (at your option) any later version.
|
|
||||||
#
|
|
||||||
# MOTDs32 is distributed in the hope that it will be useful,
|
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
# GNU General Public License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU General Public License
|
|
||||||
# along with MOTDs32. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
#mkdir /etc/motds32/
|
|
||||||
|
|
||||||
/etc/motds32/Stats32 > /etc/motds32/Stats32.txt
|
/etc/motds32/Stats32 > /etc/motds32/Stats32.txt
|
||||||
# Path to the configuration file
|
# Path to the configuration file
|
||||||
|
@ -532,16 +519,7 @@ function gen_mount_point_table() {
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
# display usage
|
|
||||||
function usage {
|
|
||||||
echo "Usage: motds32 OPTIONS"
|
|
||||||
|
|
||||||
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!"
|
|
||||||
exit 0
|
|
||||||
}
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# Main program
|
# Main program
|
||||||
|
@ -557,6 +535,17 @@ else
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# display usage
|
||||||
|
function usage {
|
||||||
|
echo "Usage: motds32 OPTIONS"
|
||||||
|
|
||||||
|
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!"
|
||||||
|
exit 0
|
||||||
|
}
|
||||||
|
|
||||||
case $1 in
|
case $1 in
|
||||||
-g|--generate)
|
-g|--generate)
|
||||||
;;
|
;;
|
||||||
|
@ -573,7 +562,7 @@ case $1 in
|
||||||
exit 0
|
exit 0
|
||||||
;;
|
;;
|
||||||
-m|--MOTDs32)
|
-m|--MOTDs32)
|
||||||
echo "motds32 check motd file"
|
echo "Read motds32 file"
|
||||||
cat /etc/motd
|
cat /etc/motd
|
||||||
exit 0
|
exit 0
|
||||||
;;
|
;;
|
||||||
|
@ -628,14 +617,13 @@ 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
|
||||||
#/etc/motds32/Stats32 > /etc/motds32/Stats32.txt
|
|
||||||
|
|
||||||
# Check if server has rebooted (current uptime < stored uptime
|
# Check if server has rebooted (current uptime < stored uptime
|
||||||
if [ -s $STATS_DIR/uptime ]; then
|
if [ -s $STATS_DIR/uptime ]; then
|
||||||
|
|
Loading…
Reference in a new issue