ssh - running rsync in crontab with keys -


i having issues running rysnc in crontab. it's own users's crontab runs user, , i've set passwordless rsa keys. when run rsync job on shell console, works. when import crontab, says ran in /var/log/syslog, don't see folder synced.

my crontab super simple:

* * * * * rsync -av --delete myuser@mybox:/home/backup/ /home/backup 

i believe crontab not picking user's environment. if following, can see environment variables:

* * * * * env >> /tmp/my_env_variables 

this outputs cat /tmp/my_env_variables

language=en_us.utf-8 home=/home/myuser logname=myuser path=/usr/bin:/bin lang=en_us.utf-8 shell=/bin/sh pwd=/home/myuser 

i don't have env variables such as:

ssh_auth_sock=/tmp/ssh-uapl7niovj/agent.103170 

what's right way import env variables need in cron?

from man 5 crontab:

an active line in crontab either environment setting or cron command. environment setting of form:

name = value 

however, requiring ssh agent present when cron-job runs going unreliable. if want work you're going need pass-phrase-less key set up. can restrict key, in authorized_keys on server, work specific ip address.


Comments

Popular posts from this blog

javascript - Thinglink image not visible until browser resize -

firebird - Error "invalid transaction handle (expecting explicit transaction start)" executing script from Delphi -

mongodb - How to keep track of users making Stripe Payments -