Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Mac OS X > Shell scripting question

Shell scripting question
Thread Tools
Fresh-Faced Recruit
Join Date: Nov 2002
Location: Boulder/Colorado Springs
Status: Offline
Reply With Quote
Jan 13, 2003, 03:00 PM
 
I'm trying to make a script to automatically backup my web site on a remote server. Here's my code (this is my first attempt at scripting so it might not be too good):

Code:
#!/bin/sh CURRENT_DATE=`date "+%m-%d-%y"` scp -r source ~/Sites/"public_html_backup ${CURRENT_DATE}" echo $CURRENT_DATE
Is there a way to automatically input my password for scp so I can run this as a cron script and I don't have to manually log in?
Mischief. Mayhem. Macs.
     
Dedicated MacNNer
Join Date: Oct 2001
Location: Philly
Status: Offline
Reply With Quote
Jan 13, 2003, 07:42 PM
 
Originally posted by sliderule:
Is there a way to automatically input my password for scp so I can run this as a cron script and I don't have to manually log in?
Set up public key authentication. Read the manual page for ssh-keygen for details.
     
Mac Elite
Join Date: May 1999
Location: San Jose, CA
Status: Offline
Reply With Quote
Jan 13, 2003, 10:56 PM
 
I don't see where you're being asked for a password.

Your script is using scp to copy from a local directory ('source') to another local directory ('~/Sites/public_html/etc.)

Copying files locally doesn't need any password.
Gods don't kill people - people with Gods kill people.
     
Fresh-Faced Recruit
Join Date: Nov 2002
Location: Boulder/Colorado Springs
Status: Offline
Reply With Quote
Jan 14, 2003, 12:44 AM
 
source is a remote server. Sorry for the confusion. Also, it doesn't look like I can write my key to the server for ssh-keygen.
Mischief. Mayhem. Macs.
     
   
Thread Tools
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Top
Privacy Policy
All times are GMT -5. The time now is 08:10 PM.
All contents of these forums © 1995-2011 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.7 © 2000-2011, Jelsoft Enterprises Ltd., Content Relevant URLs by vBSEO 3.3.2