Find the answer to your Linux question:
Results 1 to 4 of 4
Hai, I am new to suse linux, in my working environment i have one mail server every day we will take backup using script, that backup will store in one ...
  1. #1
    Just Joined!
    Join Date
    Feb 2009
    Posts
    6

    Arrow write shell script

    Hai,

    I am new to suse linux, in my working environment i have one mail server every day we will take backup using script, that backup will store in one directory, but i want to move data when new backup will come that directory na automatically old backup should move to the another location like that i want script give any clues

  2. #2
    Linux Newbie sdimhoff's Avatar
    Join Date
    Jan 2007
    Posts
    191
    If you have a regular naming scheme for your backups this is nice and simple. For example, lets assume that the most recent files to be backed up will be called:

    mail-backup.tar.gz

    and that when you will be bringing in a new backup, you want the old ones moved to the name:

    mail-backup-01.tar.gz

    In this case, all you have to do is put a line in your script which will rename the current backups to make room for the new ones:

    Code:
    ....
    mv /path/to/mail-backup.tar.gz /path/to/mail-backup-01.tar.gz
    ...
    #Now you can have the backup part of the script here
    tar -<options> /mail/files /path/to/mail-backup.tar.gz
    You only need to move a few files each time if you just plan on keeping a few of the recent backups. If you plan on keeping all backups ever created, then you will want to have a more sophisticated naming scheme (e.g. Have you backups named with their respective dates tacked on to the filename so that there will never be any fear of overwriting a backup)

    Hope that helps
    Linux since: 2001
    Gentoo since: 2004
    - - - - - - - -
    Translation:
    I fix things until they break.

  3. #3
    Just Joined!
    Join Date
    Feb 2009
    Posts
    6

    Arrow shell script

    Hai,

    manually i know, but i want to put in to the script file,
    for ex:

    every day i am taking backup /backup directory, fine name back010309....like that, but after one week when the new backup will create na, old backup should move to the another directory, this thing i want to add in my backup script file

  4. #4
    Linux Newbie sdimhoff's Avatar
    Join Date
    Jan 2007
    Posts
    191
    Sorry for being unclear, or maybe we are just on different wavelengths.

    I meant that you could just put the mv command into your script. It would go into the script right before your backup commands so that your older backups have been moved/renamed before your newest backup file takes its place.
    Linux since: 2001
    Gentoo since: 2004
    - - - - - - - -
    Translation:
    I fix things until they break.

Posting Permissions

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