Automate db:pull from heroku
You need to use expect since “heroku db:pull” is interactive and requires user input.
Alternatively, you can use expectj which as you may have already guessed, is the java implementation of expect.
One advantage of using expectj is that your IDE will autocomplete the expect commands for you.
#!/bin/sh
expect -c "
#Your timeout should correspond to the number of seconds you expect pull to take.
set timeout 600
spawn heroku db:pull sqlite:///home/www/sites/xxx/db/xxxbackup.sqlite3 --app xxx
expect \"Are you sure you wish to continue? (y/n)? \"
send \"y\r\"
set results $expect_out(buffer)
expect eof"
date >> /home/www/sites/xxx/db/backuplog.log
echo "db pull done"
