Page 1 of 2 12 LastLast
Results 1 to 10 of 11

Thread: cron pruning of backups

  1. #1
    ThorGoLucky's Avatar
    ThorGoLucky is offline Special Member
    Join Date
    Jun 2006
    Location
    Corvallis, Oregon, USA
    Posts
    100
    Rep Power
    9

    Default cron pruning of backups

    Hi, I have an entry in my crontab for the root user that is supposed to delete all backups that are older than a week.

    crontab -u root -l
    30 17 * * * /usr/bin/sudo -u zimbra /opt/zimbra/bin/zmbackup --delete $(date -d "7 days ago" +"%Y/%m/%d")

    But it does not work as a cron job. The backups keep piling up until I manually run the command. Any suggestions?

  2. #2
    phoenix is online now Zimbra Consultant & Moderator
    Join Date
    Sep 2005
    Location
    Vannes, France
    Posts
    23,568
    Rep Power
    57

    Default

    What happens if you run it manually, do the old backups get deleted?
    Regards


    Bill


    Acompli: A new adventure for Co-Founder KevinH.

  3. #3
    ThorGoLucky's Avatar
    ThorGoLucky is offline Special Member
    Join Date
    Jun 2006
    Location
    Corvallis, Oregon, USA
    Posts
    100
    Rep Power
    9

    Default

    Quote Originally Posted by phoenix View Post
    What happens if you run it manually, do the old backups get deleted?
    Yes, it works fine when I run it manually.

  4. #4
    phoenix is online now Zimbra Consultant & Moderator
    Join Date
    Sep 2005
    Location
    Vannes, France
    Posts
    23,568
    Rep Power
    57

    Default

    Shouldn't it be installed as the zimbra user rather than root or is root correct? Sorry, I'm not a NE user so that may be a silly question.
    Regards


    Bill


    Acompli: A new adventure for Co-Founder KevinH.

  5. #5
    ThorGoLucky's Avatar
    ThorGoLucky is offline Special Member
    Join Date
    Jun 2006
    Location
    Corvallis, Oregon, USA
    Posts
    100
    Rep Power
    9

    Default

    Quote Originally Posted by phoenix View Post
    Shouldn't it be installed as the zimbra user rather than root or is root correct? Sorry, I'm not a NE user so that may be a silly question.
    I cannot (should not) touch the zimbra user cron because it's configured by Zimbra and I don't want to mess it up. I use the root user cron all the time on other servers too with no problem. Perhaps it has something to do with the quotes in the command. Hmm.

  6. #6
    phoenix is online now Zimbra Consultant & Moderator
    Join Date
    Sep 2005
    Location
    Vannes, France
    Posts
    23,568
    Rep Power
    57

    Default

    I don't know enough about the backup utility to advise you, I'd suggest a quick email to support as being your best option for a speedy resolution.
    Regards


    Bill


    Acompli: A new adventure for Co-Founder KevinH.

  7. #7
    rsharpe is offline Elite Member & Volunteer
    Join Date
    Nov 2005
    Location
    London, ON
    Posts
    255
    Rep Power
    9

    Default

    Why don't you give this a try:

    30 17 * * * /usr/bin/su -c zimbra '/opt/zimbra/bin/zmbackup --delete $(date -d "7 days ago" +"%Y/%m/%d")'

  8. #8
    ThorGoLucky's Avatar
    ThorGoLucky is offline Special Member
    Join Date
    Jun 2006
    Location
    Corvallis, Oregon, USA
    Posts
    100
    Rep Power
    9

    Default

    Quote Originally Posted by rsharpe View Post
    Why don't you give this a try:

    30 17 * * * /usr/bin/su -c zimbra '/opt/zimbra/bin/zmbackup --delete $(date -d "7 days ago" +"%Y/%m/%d")'
    Good idea! I'll see if it works tomorrow.

  9. #9
    ThorGoLucky's Avatar
    ThorGoLucky is offline Special Member
    Join Date
    Jun 2006
    Location
    Corvallis, Oregon, USA
    Posts
    100
    Rep Power
    9

    Default

    Quote Originally Posted by rsharpe View Post
    Why don't you give this a try:

    30 17 * * * /usr/bin/su -c zimbra '/opt/zimbra/bin/zmbackup --delete $(date -d "7 days ago" +"%Y/%m/%d")'
    That doesn't work, not even manually. Thanks for the suggestion though.
    /usr/bin/sudo: /opt/zimbra/bin/zmbackup --delete $(date -d "7 days ago" +"%Y/%m/%d"): command not found

  10. #10
    brian is offline Project Contributor
    Join Date
    Jul 2006
    Posts
    623
    Rep Power
    10

    Default

    You should really use zmschedulebackup to adjust the backup schedule and retention. It will adjust the zimbra crontab and maintain it appropriately.

    See Change backups from Monthly to Weekly
    for changing the default retention from 1m to 7days.

    You're probably looking for something like
    % zmschedulebackup -R f "0 1 * * 6" i "0 1 * * 0-5" d 7d "0 0 * * *"
    Schedule replaced

    Current Schedule:

    f 0 1 * * 6
    i 0 1 * * 0-5
    d 7d 0 0 * * *

    Use this to give a copy of your current schedule and manipulate as needed.
    % zmschedulebackup -s
    f "0 1 * * 6" i "0 1 * * 0-5" d 7d "0 0 * * *"

Page 1 of 2 12 LastLast

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Backups fail after workaround for bug 10827
    By warbirdcharles in forum Administrators
    Replies: 1
    Last Post: 07-17-2007, 12:07 PM
  2. How To Vet If Backups Are Working?
    By LMStone in forum Administrators
    Replies: 2
    Last Post: 03-19-2007, 06:38 PM
  3. Spam training has no cron job
    By richard-hdd in forum Administrators
    Replies: 3
    Last Post: 09-13-2006, 11:50 AM
  4. Replies: 0
    Last Post: 08-22-2006, 10:12 AM
  5. Problems with Zimbra Cron Jobs
    By soxfan in forum Administrators
    Replies: 9
    Last Post: 08-22-2006, 09:02 AM

Posting Permissions

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