aboutsummaryrefslogtreecommitdiffstats
path: root/cron-sh
diff options
context:
space:
mode:
authorEugeni Dodonov <eugeni@mandriva.org>2010-02-08 14:05:18 +0000
committerEugeni Dodonov <eugeni@mandriva.org>2010-02-08 14:05:18 +0000
commit17f062c6f40bffd8fc3c6eebec8b9daa651d1335 (patch)
tree6335562964de7a3e6a22e9576149f21b223a6e8d /cron-sh
parent8b1cc778159c690f4ea1e140ffe547a9e5b462b5 (diff)
downloadmsec-17f062c6f40bffd8fc3c6eebec8b9daa651d1335.tar
msec-17f062c6f40bffd8fc3c6eebec8b9daa651d1335.tar.gz
msec-17f062c6f40bffd8fc3c6eebec8b9daa651d1335.tar.bz2
msec-17f062c6f40bffd8fc3c6eebec8b9daa651d1335.tar.xz
msec-17f062c6f40bffd8fc3c6eebec8b9daa651d1335.zip
properly detecting check periodicity
Diffstat (limited to 'cron-sh')
-rw-r--r--cron-sh/functions.sh20
1 files changed, 8 insertions, 12 deletions
diff --git a/cron-sh/functions.sh b/cron-sh/functions.sh
index 9592e36..61a54ec 100644
--- a/cron-sh/functions.sh
+++ b/cron-sh/functions.sh
@@ -45,28 +45,24 @@ function check_is_enabled() {
check=$1
SCRIPT_DIR=$(dirname $0)
if [ "a$check" = "ano" ]; then
- echo no
- return 0
+ return 1
fi
# check if the test is supposed to be executed on this run
echo $SCRIPT_DIR | grep -q $check
val=$?
if [ "$val" = "0" ]; then
- echo yes
- return 1
+ return 0
fi
- # is it a manual check?
- istty=$(tty -s)
- if $istty && [ "$check" = "manual" ]; then
- echo yes
- return 1
+ # is the check being run manually (e.g., it is not a crontab symlink?)
+ # NOTE: this only checks if the file is a symlink, assuming that the manual check
+ # is performed by running the /usr/share/msec/security.sh directly
+ if [ "$check" = "manual" -a ! -L $0 ]; then
+ return 0
fi
- echo no
- return 0
+ return 1
}
-
Diffcheck() {
TODAY="$1"
YESTERDAY="$2"