Page 2 of 2 FirstFirst 12
Results 11 to 20 of 20

Thread: Squirrelmail Backup and Restore Tutorial?

  1. #11
    Join Date
    Jan 2013
    Beans
    203

    Re: Squirrelmail Backup and Restore Tutorial?

    nerdtron,

    Thanks for the detailed explanation of the rsync commands. I used it in the past with some success to test file transfer from server to server. I will attempt the back up and then eventually restore. Will keep thread posted.

  2. #12
    Join Date
    Jan 2013
    Beans
    203

    Re: Squirrelmail Backup and Restore Tutorial?

    nerdtron do I need to kill any processes before running the rsync command? I needed Ubuntu Forums to come back up so I could reference the commands. My target date is this Sunday.

  3. #13
    Join Date
    Aug 2009
    Location
    Makati City, Philippines
    Beans
    2,269
    Distro
    Xubuntu 16.04 Xenial Xerus

    Re: Squirrelmail Backup and Restore Tutorial?

    Here's how i did it to minimize the downtime on our mail server migration. Execute rsync on the live system with running processes. I t won't affect much of the performance. Also, it will copy the bulk of all emails which could take several minutes.
    After that, make the 2 servers offline, the old and the new servers. This will cause email services to stop so please send a notification to them that you'll do a server maintenance.
    Now do the rsync again to copy the extra emails that were left out while you were doing the first rsync. You'll do this to make sure you copied everything. This will only take a few minutes (or seconds) depending on the amount of new data that needs to be copied.
    Connect the new server to the network to receive the new mails.

    OR if you are just going to do a backup and not migration, no need to kill any processes. Just execute the rsync command and it'll do the backup for you.

  4. #14
    Join Date
    Jan 2013
    Beans
    203

    Re: Squirrelmail Backup and Restore Tutorial?

    Quote Originally Posted by nerdtron View Post
    Here's how i did it to minimize the downtime on our mail server migration. Execute rsync on the live system with running processes. I t won't affect much of the performance. Also, it will copy the bulk of all emails which could take several minutes.
    After that, make the 2 servers offline, the old and the new servers. This will cause email services to stop so please send a notification to them that you'll do a server maintenance.
    Now do the rsync again to copy the extra emails that were left out while you were doing the first rsync. You'll do this to make sure you copied everything. This will only take a few minutes (or seconds) depending on the amount of new data that needs to be copied.
    Connect the new server to the network to receive the new mails.

    OR if you are just going to do a backup and not migration, no need to kill any processes. Just execute the rsync command and it'll do the backup for you.
    I've successfully backed up the data. Or so it appears. If I am to understand correctly. The --delete-excluded and --delete switch will make a 1 to 1 copy? meaning if a file is present on the backup but not on the source. It will delete the backup file?

    Now how will I go about setting up a cron job/script to automate this? Thanks again for all the help.

  5. #15
    Join Date
    Aug 2009
    Location
    Makati City, Philippines
    Beans
    2,269
    Distro
    Xubuntu 16.04 Xenial Xerus

    Re: Squirrelmail Backup and Restore Tutorial?

    Quote Originally Posted by lingpanda View Post
    The --delete-excluded and --delete switch will make a 1 to 1 copy? meaning if a file is present on the backup but not on the source. It will delete the backup file?

    Now how will I go about setting up a cron job/script to automate this? Thanks again for all the help.
    Yes. You are correct on the --delete and --delete-excluded switch. If you finished rsync today and then some files where deleted on the source, the next day you rsync, the files on the backup will also be deleted.

    I haven't tried this yet but I think it should work. Please make sure that you can login without via ssh without password to the remote server from the local server you are going to execute the rsync command.
    Generate keys and don't enter any password. Then copy the keys to the remote server.
    Code:
    ssh-keygen
    ssh-copy-id user@remoteserver
    Try to ssh to the remote server and you should not be asked for a password.

    Create an empty file and make it executable. Name it rsync.sh and put it in /home/username/rsync.sh
    Put in this file you rsync command.
    Edit the crontab.
    Code:
    crontab -e
    Add a line like this.
    Code:
    @daily /home/username/rsync.sh
    If you want more control over the crontab schedule, read here and here.

  6. #16
    Join Date
    Jan 2013
    Beans
    203

    Re: Squirrelmail Backup and Restore Tutorial?

    nerdtron I believe I have everything set and ready to go. My crontab options for this are "* 6 * * 0". My understanding is this will run @6am every Sunday? If correct I'm good to go and I thank you for your assistance.

  7. #17
    Join Date
    Apr 2008
    Location
    LOCATION=/dev/random
    Beans
    5,767
    Distro
    Ubuntu Development Release

    Re: Squirrelmail Backup and Restore Tutorial?

    Quote Originally Posted by lingpanda View Post
    My crontab options for this are "* 6 * * 0". My understanding is this will run @6am every Sunday?
    No.

    You need...
    Code:
    0 6 * * 0
    What you have will run your crontab every minute during the hour of 6AM on a Sunday.
    Cheesemill

  8. #18
    Join Date
    Nov 2008
    Location
    Boston MetroWest
    Beans
    16,326

    Re: Squirrelmail Backup and Restore Tutorial?

    Quote Originally Posted by nerdtron View Post
    Create an empty file and make it executable. Name it rsync.sh and put it in /home/username/rsync.sh
    Put in this file you rsync command.
    Edit the crontab.
    Code:
    crontab -e
    Add a line like this.
    Code:
    @daily /home/username/rsync.sh
    Any scripts that need to be run with root privileges like comprehensive backups should be referenced in crontabs owned by root, not by an ordinary user. The simplest solution is to put the scripts, or symlinks to them, in the appropriate /etc/cron.* directories. To run a job once a week, put the script in /etc/cron.weekly. The daily and weekly scripts are run just before 7 am by default. To change these times, edit (as root with sudo) the file /etc/crontab and change the entries appropriately.
    If you ask for help, do not abandon your request. Please have the courtesy to check for responses and thank the people who helped you.

    Blog · Linode System Administration Guides · Android Apps for Ubuntu Users

  9. #19
    Join Date
    Jan 2013
    Beans
    203

    Re: Squirrelmail Backup and Restore Tutorial?

    Quote Originally Posted by Cheesemill View Post
    No.

    You need...
    Code:
    0 6 * * 0
    What you have will run your crontab every minute during the hour of 6AM on a Sunday.
    Cheesemill thanks for the clarification.

  10. #20
    Join Date
    Jan 2013
    Beans
    203

    Re: Squirrelmail Backup and Restore Tutorial?

    Quote Originally Posted by SeijiSensei View Post
    Any scripts that need to be run with root privileges like comprehensive backups should be referenced in crontabs owned by root, not by an ordinary user. The simplest solution is to put the scripts, or symlinks to them, in the appropriate /etc/cron.* directories. To run a job once a week, put the script in /etc/cron.weekly. The daily and weekly scripts are run just before 7 am by default. To change these times, edit (as root with sudo) the file /etc/crontab and change the entries appropriately.
    SeijiSensei I did make sure to have root run the script. Thanks for the clarification as well.

Page 2 of 2 FirstFirst 12

Bookmarks

Posting Permissions

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