Skip to content

Instantly share code, notes, and snippets.

@jamesbowman
Created January 30, 2018 16:35
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jamesbowman/935b275eaa356ac66268f3481d06e6bd to your computer and use it in GitHub Desktop.
Save jamesbowman/935b275eaa356ac66268f3481d06e6bd to your computer and use it in GitHub Desktop.
/data/backup/$TODAY#!/bin/bash -e
read -r YESTERDAY TODAY <<<$(
python3 -c '
import datetime
def day_to_slot(n):
return bin(n)[::-1].index("1")
n = datetime.date.today().toordinal()
print(day_to_slot(n - 1))
print(day_to_slot(n))
')
rsync -avz --link-dest=/data/backup/$YESTERDAY ~ remote:/data/backup/$TODAY
ssh remote touch /data/backup/$TODAY
@RGD2
Copy link

RGD2 commented Apr 27, 2019

James explains it over here

The stuff before the # on the first line I think is just a mistake.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment