summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'app-forensics/rkhunter/files/rkhunter.cron')
-rw-r--r--app-forensics/rkhunter/files/rkhunter.cron20
1 files changed, 10 insertions, 10 deletions
diff --git a/app-forensics/rkhunter/files/rkhunter.cron b/app-forensics/rkhunter/files/rkhunter.cron
index 15a4dcf46a7a..d5a763d37fe6 100644
--- a/app-forensics/rkhunter/files/rkhunter.cron
+++ b/app-forensics/rkhunter/files/rkhunter.cron
@@ -1,5 +1,5 @@
#!/bin/bash
-# $Header: /var/cvsroot/gentoo-x86/app-forensics/rkhunter/files/rkhunter.cron,v 1.2 2004/12/07 10:33:36 ka0ttic Exp $
+# $Header: /var/cvsroot/gentoo-x86/app-forensics/rkhunter/files/rkhunter.cron,v 1.3 2005/09/02 09:58:35 ka0ttic Exp $
# original author: Aaron Walker <ka0ttic@gentoo.org>
########################## Begin Configuration ###############################
@@ -49,21 +49,21 @@ VERBOSITY=3
########################### End Configuration ################################
# exit immediately, unless enabled
-[[ "${ENABLE}" != "yes" ]] && exit 0
+[[ "${ENABLE}" == "yes" ]] || exit 0
# debug mode? (mainly for my benefit)
-if [ -n "$1" ] && [ "$1" = "-d" ] ; then
+if [[ -n "${1}" ]] && [[ ${1} = "-d" ]] ; then
set -o verbose -o xtrace
fi
-[ -z "${LOGFILE}" ] && LOGFILE="/var/log/rkhunter.log"
+[[ -z "${LOGFILE}" ]] && LOGFILE="/var/log/rkhunter.log"
# moved this out of config section since it'll
# probably never need to be changed
RKHUNTER_EXEC="/usr/bin/rkhunter"
# sanity check
-if [ ! -x "${RKHUNTER_EXEC}" ] ; then
+if [[ ! -x "${RKHUNTER_EXEC}" ]] ; then
echo "${RKHUNTER_EXEC} does not exist or is not executable!"
exit 1
fi
@@ -73,7 +73,7 @@ fi
umask 0077
# all output goes to this temp file
-_tmpout="/tmp/rkhunter.cron.${RANDOM}"
+_tmpout=$(mktemp /tmp/rkhunter.cron.XXXXXX)
exec > ${_tmpout} 2>&1
# update data files
@@ -98,8 +98,8 @@ esac
# save old log
if [[ "${LOG}" == "yes" && "${SAVE_OLD_LOGS}" == "yes" ]] ; then
- if [ -e "${LOGFILE}" ] ; then
- _tmpfile="${LOGFILE}.${RANDOM}"
+ if [[ -e "${LOGFILE}" ]] ; then
+ _tmpfile=$(mktemp ${LOGFILE}.XXXXXX)
mv -f ${LOGFILE} ${_tmpfile}
echo -e "--\nrkhunter.cron commencing at: $(date)\n--" >> ${_tmpfile}
fi
@@ -117,14 +117,14 @@ if [[ "${SEND_EMAIL}" == "yes" ]] ; then
fi
# remove temp file
-[ -n "${_tmpout}" ] && rm -f ${_tmpout}
+[[ -n "${_tmpout}" ]] && rm -f ${_tmpout}
[[ "${LOG}" != "yes" ]] && exit ${RV}
# from this point on, we can assume logging is enabled
# append new log to old log and restore
-if [ -n "${_tmpfile}" ] ; then
+if [[ -n "${_tmpfile}" ]] ; then
cat ${LOGFILE} >> ${_tmpfile}
mv ${_tmpfile} ${LOGFILE}
fi