aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLAN-TW <lantw44@gmail.com>2012-04-08 00:31:51 +0800
committerLAN-TW <lantw44@gmail.com>2012-04-08 00:31:51 +0800
commit5edfdba70f63efc2757a8bd5ccf5e786d03319d2 (patch)
tree900ddc7849b1c3eb94e276ac3ac493bc415266f8
parent0edc77e9862fc76c62bdc557655282783efa434b (diff)
downloadconfigfile-5edfdba70f63efc2757a8bd5ccf5e786d03319d2.tar
configfile-5edfdba70f63efc2757a8bd5ccf5e786d03319d2.tar.gz
configfile-5edfdba70f63efc2757a8bd5ccf5e786d03319d2.tar.bz2
configfile-5edfdba70f63efc2757a8bd5ccf5e786d03319d2.tar.lz
configfile-5edfdba70f63efc2757a8bd5ccf5e786d03319d2.tar.xz
configfile-5edfdba70f63efc2757a8bd5ccf5e786d03319d2.tar.zst
configfile-5edfdba70f63efc2757a8bd5ccf5e786d03319d2.zip
bash_include: 背景檢查與通知系統狀態的函式bash_include-20120407
-rw-r--r--bash_include31
1 files changed, 31 insertions, 0 deletions
diff --git a/bash_include b/bash_include
index a0f3054..145bacd 100644
--- a/bash_include
+++ b/bash_include
@@ -319,6 +319,36 @@ function check_dmesg ()
done
}
+function check_system_status ()
+{
+ [ "$#" = "0" ] && return 1
+
+ filename_mail="$MAIL"
+ filename_messages="/var/log/messages"
+ filename_audit="/var/log/audit/audit.log"
+
+ while true
+ do
+ previous_dmesg_buf="$current_dmesg_buf"
+ current_dmesg_buf="`dmesg`"
+ previous_mail_info="$current_mail_info"
+ current_mail_info="`ls -l "$filename_mail"`"
+ previous_messages_info="$current_messages_info"
+ current_messages_info="`ls -l "$filename_messages"`"
+ previous_audit_info="$current_audit_info"
+ current_audit_info="`ls -l "$filename_audit"`"
+ if [ "$first_run" = "0" ]
+ then
+ [ "$previous_dmesg_buf" '!=' "$current_dmesg_buf" ] && echo "===> The system message buffer is modified (dmesg) <==="
+ [ "$previous_mail_info" '!=' "$current_mail_info" ] && echo "===> Your mailbox $filename_mail is modified <==="
+ [ "$previous_messages_info" '!=' "$current_messages_info" ] && echo "===> $filename_messages is modified <==="
+ [ "$previous_audit_info" '!=' "$current_audit_info" ] && echo "===> $filename_audit is modified <==="
+ fi
+ sleep $1
+ first_run=0
+ done
+}
+
function prehistory_backup ()
{
echo "Checking your current history file"
@@ -871,6 +901,7 @@ function help_function ()
<<< Other >>>
backup_file filename ... [-- sudo_prefix ]
check_dmesg seconds
+ check_system_status seconds
check_important_files
compile_all [-n] filename ...
convert_to_html filename ...