Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

scp in a crontab

Status
Not open for further replies.

ilovelinux2006

Programmer
Jun 6, 2006
32
US
Hey everyone,

I got my server to run ssh with an rsa key, so I don't need to use a password when ssh'ing between servers. Anways, i created a bash script:

#!/bin/bash

scp file username@theserver.com:/home/user



Ok, when I bash this in the shell, It works fine 100% and exports to the other server. But when I run it with crontab to run everyone minute, it doesn't work. Does anyone know why?
 
Check your mail.

If you haven't redirected output to a log file in the crontab, the output of the command will me mailed to you. That should have any pertinent error messages.
 
This question comes round at about three month intervals, indeed it is asked so frequently it's in the FAQs. Whilst the problem might be SSH/SCP specific I'm pretty sure it's the same old, same old.
<soapbox>
Please always do a search, and check the FAQs before posting. It will save you time as well as us.
</soapbox>

Ceci n'est pas une signature
Columb Healy
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top