Skip to content

Instantly share code, notes, and snippets.

@fmitha
Created May 10, 2021 10:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fmitha/90d0dd3d12b0d357c2864501d8532b2f to your computer and use it in GitHub Desktop.
Save fmitha/90d0dd3d12b0d357c2864501d8532b2f to your computer and use it in GitHub Desktop.
# https://stackoverflow.com/q/20510301/350713
#!/usr/bin/expect -f
exp_internal 1
set backupdir "/mnt/db-backups/"
set now [clock seconds]
set date [clock format $now -format {%Y-%m-%d}]
set filename $date
append filename "_dbbackups.sql"
#exec mysqldump -u root --all-databases --events > $backupdir$filename
#spawn zip -e $backupdir$filename.enc.zip $backupdir$filename
exec rm -f repo.zip
spawn zip -e -r repo.zip repo
# expect {
# "Enter password: " { send "monkey\r"
# exp_continue
# }
# "Verify password: " {send "monkey\r"
# exp_continue
# }
# }
expect "Enter password: "
send -- "monkey\r"
expect "Verify password: "
send -- "monkey\r"
exp_continue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment