test-0001.sh 698 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. #!/bin/bash
  2. . ./test-common.sh
  3. # we don't want any stuff left from previous runs
  4. cleanup 1
  5. # ------------------------------- Test 1 -------------------------------------
  6. # Without a log file, no rotations should occur
  7. preptest test.log 1 2
  8. $RLR test-config.1
  9. checkoutput <<EOF
  10. test.log 0 zero
  11. test.log.1 0 first
  12. EOF
  13. # Put in place a state file that will force a rotation
  14. cat > state <<EOF
  15. logrotate state -- version 1
  16. "$PWD/test.log" 2000-1-1
  17. EOF
  18. # Now force the rotation
  19. $RLR test-config.1
  20. checkoutput <<EOF
  21. test.log 0
  22. test.log.1 0 zero
  23. test.log.2 0 first
  24. EOF
  25. # rerun it to make sure nothing happens
  26. $RLR test-config.1
  27. checkoutput <<EOF
  28. test.log
  29. test.log.1 0 zero
  30. test.log.2 0 first
  31. EOF