Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

knome

macrumors 6502
Original poster
Sep 7, 2006
332
0
I'm having issues setting up cron scripts that log into a server automatically via ssh.

I created the automatic ssh login using this:
http://www.ccp4.ac.uk/peter/programming/automatic_ssh_login.html

i followed this how to in order to set the the cron job:
http://www.tech-geeks.org/contrib/mdrone/cron&crontab-howto.htm

I tested the scrip manually but it still requires me to enter the password for the ssh login. But if i manually type it in the console it logs me into the server instantly without a password.

So how do you get the auto ssh login to work inside of scripts?

How do i check to see if my cron job has been added?

here is the scrip i am trying to run

Code:
#!/bin/bash

rsync -v -r -z -u --exclude '.DS_Store' user@myserver:/media/extra/backups/projects/ /Users/myusername/Documents/Projects/

Here is the code that i injected into the crontab

0 * * * * /etc/periodic/hourly/*
 
Thats what has me confused. I did this about 9 months ago with a different computer and the same server for backups and i don't have a line like that in the cron file and it works just fine. I have absolutely no idea what i did.
 
Well now i have to start from scratch. I was messing with it and now not only is my old one not working but i can't get any type of auto login to work now. :mad::mad::mad::mad::mad::mad::mad::mad::mad::mad::mad::mad::mad:
 
How do i check to see if my cron job has been added?

Use:
crontab -l [optionally -u username]

Keep in mind that every user has their own crontab file, and their own .ssh/authorized_keys file

It sounds like you may not be running your script with the same user that is allowed in the remote authorized_keys
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.