Find the answer to your Linux question:
Results 1 to 3 of 3
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined! jdh239's Avatar
    Join Date
    Sep 2006
    Posts
    92

    logrotate "prerotate" not working


    I have a script that does some work for me. If I run it manually the script works fine. If I try to call it within logrotate it never works. I don't believe logrotate ever calls the script as it should. I could use a second pair of eyes to see if I am doing something wrong:

    Code:
    /var/log/CPU_troubleshooting.tar.gz {
        hourly
        missingok
        rotate 14
        dateext
        prerotate
          /home/someuser/scripts/CPU_troubleshooting.sh -t
        endscript
    }
    Any suggestions?

  2. #2
    Just Joined! jdh239's Avatar
    Join Date
    Sep 2006
    Posts
    92
    Anyone? I still haven't been able to get this to work

  3. #3
    Just Joined! jdh239's Avatar
    Join Date
    Sep 2006
    Posts
    92
    -->
    I believe I figured it out. I was reading something somewhere that said unless the file exists it will not execute the prerotate (I am assuming firstaction, lastaction, and postrotate also). Once the file was there it executed fine.

    My problem was my script. The CPU_troubleshooting.sh -t creates the file that has to be rotated.... so a flaw in the way I was doing this (long story as to why I was doing it this way instead of all through logrotate)

$spacer_open
$spacer_close

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •