From 17f062c6f40bffd8fc3c6eebec8b9daa651d1335 Mon Sep 17 00:00:00 2001 From: Eugeni Dodonov Date: Mon, 8 Feb 2010 14:05:18 +0000 Subject: properly detecting check periodicity --- cron-sh/functions.sh | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) (limited to 'cron-sh/functions.sh') 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" -- cgit v1.2.1