Post tagged: snippet

Expect the Unexpected

Problem

Need to automate an rsync to a fileserver and, unfortunately, required to authenticate using a password.

Solution

Use expect...

#!/usr/bin/expect

set timeout 20
set password [lindex $argv 0]

spawn rsync -av --no-p --no-g  /media/ryant/My\ Book/Photo/ user@10.10.10.12:/Data/Public/Photos/

expect …