Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migrated to Confluence 4.0

Commands succinctly stated

Log into your server's command line with putty

...

now ssh"ing" from your original server to the three ip adresses and it should prompt with "Are you sure you want to continue connecting (yes/no)?" *<yes>. *Ensure that you do this for all three servers.

Using Cron and SCP for Backups and Such Introduction

This document will explain the steps required to use scp in cron. This is generally useful to do automated backups on Linux and other nix variations. Instructions

These instructions will walk you through what it takes.

Generate a private/public key pair

Simple command to do this: ssh-keygen -t rsa

Leave the passphrase empty so that cron can use it passwordless. Just be sure nobody gets your private key.

Copy the public key to the remote server scp ~/.ssh/id_rsa.pub remote_host:

Add local key to remote servers trusted key

Log on to the remote server and if there has never been a key created for this user on the remote machine, run the ssh-keygen -t rsa just to get the key directory and stuff set up.

...

chmod 644 ~/.ssh/authorized_keys

Now try logging into the remote machine again from local

ssh REMOTE_USERNAME@remote_host

...

This should also mean that scp will work the same way and you might want to test that scp works by copying a file from local to remote using scp. If no password, then we're all good.

Now lets test out cron script

My cron script for this example is simply going to copy a directory of files using scp to the remote server.

...

And that's about all she wrote. Save that in a file called backup.sh (or whatever you want to call it), chmod 755 i it and then try running it. ./backup.sh to run it. If it works, then next stop is to cron it.

Add script to cron jobs

Easiest way is to simply copy the backup.sh file into /etc/cron.daily/ . This will make it run every day. Choose another cron.SOMETIME to make it run more or less often. If you want more control on when it's run, read up on adding it to the crontab.