Last active
June 24, 2019 11:27
-
-
Save marvin-marvin/4b99dc5102f10450249734c85656c1ea to your computer and use it in GitHub Desktop.
etcd backup crontab
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# make sure crontab is used | |
@reboot /usr/bin/crontab /etc/cron.d/crontab | |
#*/15 * * * * /usr/bin/crontab /etc/cron.d/crontab | |
# ENV | |
SHELL=/bin/bash | |
ETCDCTL_API=3 | |
# min,hour,dayOfMonth,month,dayOfWeek | |
00 02 * * * cd /root/etcd-backup && mkdir -p `date +\%F` && cd `date +\%F` && /bin/etcdctl --endpoints=https://127.0.0.1:2379 --cacert=/etc/kubernetes/pki/etcd/ca.crt --cert=/etc/kubernetes/pki/etcd/healthcheck-client.crt --key=/etc/kubernetes/pki/etcd/healthcheck-client.key snapshot save etcd-snapshot-`date +\%F`.db > /proc/1/fd/1 2>/proc/1/fd/2 && tar -zcvf etc-kubernetes.tar.gz /etc/kubernetes > /proc/1/fd/1 2>/proc/1/fd/2 && mv etc-kubernetes.tar.gz etc-kubernetes-`date +\%F`.tar.gz && /usr/bin/rclone copy -c -v -L --drive-pacer-min-sleep=100ms --bwlimit=10M --drive-chunk-size=128M --tpslimit=100 --checkers=50 --retries=20 --transfers=10 --drive-acknowledge-abuse local:/root/etcd-backup/`date +\%F` gdrive:_backups/etcd_master/`date +\%F` > /proc/1/fd/1 2>/proc/1/fd/2 | |
# An empty line is required at the end of this file for a valid cron file. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment