File: cron

package info (click to toggle)
tripwire 1.2-15
  • links: PTS
  • area: non-free
  • in suites: slink
  • size: 1,428 kB
  • ctags: 866
  • sloc: ansic: 7,938; sh: 1,316; makefile: 425; yacc: 413; lex: 133; perl: 101
file content (47 lines) | stat: -rw-r--r-- 907 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#!/bin/sh

DATABASE="/usr/lib/tripwire/databases/tw.db_`hostname`"
DATABASEGZIP="/usr/lib/tripwire/databases/tw.db_`hostname`.gz"
LOG=/var/log/tripwire

#
# set to user to actually send mail
MAILTO=

#
#
# which binary do we use? 
#
[ -f $DATABASE ] && TRIPWIRE=/usr/lib/tripwire/tripwire
[ -f $DATABASEGZIP ] && TRIPWIRE=/usr/lib/tripwire/ztripwire

#
# do not run if there is no database file
#
[ -z "$TRIPWIRE" ] && exit 0

#
# rotate the log file if it exists
#
if [ -f $LOG ]; then
	savelog -p -g adm -m 640 -u root -c 7 $LOG > /dev/null
fi

#
# run the check
#
$TRIPWIRE -q > $LOG

#
# if the temporary file is empty do not send mail
#
[ ! -s $LOG -o -z "$MAILTO" ] && exit 0

(cat <<EOF; 
This is an automated report of possible file integrity changes, generated by
the Tripwire integrity checker.

Changed files/directories include:
EOF
cat $LOG
) | /usr/bin/mail -s "File integrity report" $MAILTO