crontool
Paste a schedule, read it in English, see the next runs.

Backing Up Redis Daily with Cron

Trigger a snapshot with `redis-cli SAVE`, then copy `dump.rdb` to a dated backup file. In crontab every `%` must be escaped as `\%` or the line is silently truncated.

The crontab line

30 2 * * * /usr/bin/redis-cli SAVE && cp /var/lib/redis/dump.rdb /backup/redis-$(date +\%Y\%m\%d).rdb

SAVE forces a synchronous snapshot to dump.rdb; the cp then archives it under a dated name.

Escape every percent sign

In crontab, an unescaped % is turned into a newline and everything after it becomes stdin. The date +%Y%m%d format must be written +\%Y\%m\%d.

Prefer BGSAVE for busy servers

SAVE blocks Redis while it writes. On a production instance use BGSAVE (background) and copy the file a few seconds later, or copy the existing dump.rdb if periodic saving is already on.

FAQ

How do I back up Redis with cron?

Force a snapshot then copy it: 30 2 * * * /usr/bin/redis-cli SAVE && cp /var/lib/redis/dump.rdb /backup/redis-$(date +\%Y\%m\%d).rdb.

Why does my redis backup cron line break at the date?

The % in date +%Y%m%d is special in crontab and truncates the line. Escape each one as \%.

Should I use SAVE or BGSAVE in a cron backup?

SAVE blocks Redis; on a busy server use BGSAVE and copy dump.rdb a few seconds later to avoid freezing clients.