[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

RE: help on a script

On Sat, 2004-06-05 at 07:25, Nick Smith wrote:
> > The script (let's call it /usr/local/bin/mail-backup).  Substitute real
> > values for the bits in square brackets:
> > 
> >         #! /bin/bash
> >         BACKUP_DIR=[backup directory]
> >         tar czf $BACKUP_DIR/mail.backup.tar.gz [mail directory name]
> >         scp $BACKUP_DIR/mail.backup.tar.gz [other machine]:[target
> > directory name]
> > 
> > 
> Is there a way to insert the date in there somewhere?

Use $(date) - you may want to add formatting options to the date
> > Make the script executable and make sure the user under whose uid it
> > will run is able to connect with ssh without supplying a password.
> > 
> How exactly would I do that? Make a user that doesn't have to supply a
> password? Like the apache default www-data? How would I set up the user?

On the target machine

   mkdir ~/.ssh

On the sending machine:

   ssh-keygen -t dsa
(leave the passphrase empty)

   scp .ssh/id_dsa.pub [other machine]:.ssh

Oliver Elphick                                          olly@lfix.co.uk
Isle of Wight                              http://www.lfix.co.uk/oliver
GPG: 1024D/A54310EA  92C8 39E7 280E 3631 3F0E  1EC0 5664 7A2F A543 10EA
     "Let your conversation be without covetousness; and be 
      content with such things as ye have. For he hath said,
      I will never leave thee, nor forsake thee."      
                                             Hebrews 13:5 

Reply to: