Created
January 30, 2018 16:35
-
-
Save jamesbowman/935b275eaa356ac66268f3481d06e6bd to your computer and use it in GitHub Desktop.
This file contains 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
/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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
What is the meaning of "/data/backup/$TODAY#!/bin/bash -e" on the first line of the script? I get the #!/bin/bash part but wonder about $TODAY. Seems to be an environment variable like $PATH but nothing is displayed with "echo $TODAY" .