Skip to content

Instantly share code, notes, and snippets.

@Voker57
Created December 12, 2016 19:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Voker57/5cc7abdb6f5e6f884d534e6d8d9ffac7 to your computer and use it in GitHub Desktop.
Save Voker57/5cc7abdb6f5e6f884d534e6d8d9ffac7 to your computer and use it in GitHub Desktop.
#!/bin/sh
# dump.bitcheese.net backup script
# stores current dump backup id in BACKUP_ID_FILE because ipfs dos not allow ipns pinning yet
BACKUP_ID_FILE=$HOME/.dump-backup-is
BACKUP_ID=""
if [ -f "$BACKUP_ID_FILE" ]
then
BACKUP_ID=`cat $BACKUP_ID_FILE`
fi
NEW_BACKUP_ID=`ipfs name resolve /ipns/QmUVuK32prRah8FDuCv1Hoz8pSksX9yUwr49EcPkMKo9XE`
if [ "$NEW_BACKUP_ID" != "$BACKUP_ID" -a ! -z "$NEW_BACKUP_ID" ]
then
if [ ! -z "$BACKUP_ID" ]
then
ipfs pin rm "$BACKUP_ID"
fi
echo "$NEW_BACKUP_ID" > "$BACKUP_ID_FILE"
ipfs pin add "$NEW_BACKUP_ID"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment