backup.sh 520 B

123456789101112
  1. #!/bin/bash
  2. suffix=$(date -d 'today' +%Y-%m-%dT%H:%M)
  3. tmpdir=$(mktemp -d)
  4. dumpfile="dump-$suffix.rdb"
  5. echo "Transeferring RDB file"
  6. # 56379 is the port of the service, in case redis is running on a different server
  7. # by passing --rdb, we are creating 'dump.rdb' on the local filesystem.
  8. redis-cli -h redis -p 56379 --rdb dump.rdb
  9. echo "Sending backup to ${BCK_USERNAME}@${BCK_HOSTNAME}"
  10. scp -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null dump.rdb "$BCK_USERNAME"@"$BCK_HOSTNAME":"$BCK_FOLDER"/"$dumpfile"