40 lines
1.2 KiB
Plaintext
40 lines
1.2 KiB
Plaintext
# Test that the zeekctl cron command does not expire crash dirs by default.
|
|
# Also test that zeekctl cron expires crash dirs when the crashexpireinterval
|
|
# option is set to a non-zero value.
|
|
#
|
|
# @TEST-EXEC: bash %INPUT
|
|
|
|
. zeekctl-test-setup
|
|
|
|
while read line; do installfile $line; done << EOF
|
|
etc/zeekctl.cfg__no_email
|
|
EOF
|
|
|
|
testcrashdir1=$ZEEKCTL_INSTALL_PREFIX/spool/tmp/post-terminate-test-1-crash
|
|
testcrashdir2=$ZEEKCTL_INSTALL_PREFIX/spool/tmp/post-terminate-test-2-crash
|
|
zeekctl install
|
|
|
|
# Verify that crash expire is off by default
|
|
zeekctl config | sed 's/ //g' | grep '^crashexpireinterval=0$'
|
|
|
|
# Create a crash dir with a recent timestamp and one with very old timestamp
|
|
mkdir ${testcrashdir1}
|
|
mkdir ${testcrashdir2}
|
|
touch -t 201210311030 ${testcrashdir1}
|
|
|
|
zeekctl cron
|
|
|
|
# Verify that zeekctl cron did not remove any crash dirs
|
|
test -e ${testcrashdir1}
|
|
test -e ${testcrashdir2}
|
|
|
|
# Update the configuration by changing the "crashexpireinterval" option
|
|
echo "crashexpireinterval=30" >> $ZEEKCTL_INSTALL_PREFIX/etc/zeekctl.cfg
|
|
zeekctl install
|
|
|
|
zeekctl cron
|
|
|
|
# Verify that zeekctl cron removed the old crash dir (and not the recent one)
|
|
test ! -e ${testcrashdir1}
|
|
test -e ${testcrashdir2}
|