mirror of
https://github.com/Steffo99/backup-duplicity.git
synced 2024-12-22 03:34:17 +00:00
Split backup and restore
This commit is contained in:
parent
f3809f4b0f
commit
d3c8292184
4 changed files with 76 additions and 50 deletions
|
@ -43,30 +43,30 @@
|
||||||
<option name="showLibraryContents" value="true" />
|
<option name="showLibraryContents" value="true" />
|
||||||
<option name="showVisibilityIcons" value="true" />
|
<option name="showVisibilityIcons" value="true" />
|
||||||
</component>
|
</component>
|
||||||
<component name="PropertiesComponent"><![CDATA[{
|
<component name="PropertiesComponent">{
|
||||||
"keyToString": {
|
"keyToString": {
|
||||||
"RunOnceActivity.ShowReadmeOnStart": "true",
|
"RunOnceActivity.ShowReadmeOnStart": "true",
|
||||||
"git-widget-placeholder": "main",
|
"git-widget-placeholder": "main",
|
||||||
"last_opened_file_path": "/store/Documents/Workspaces/Steffo99/docker-backup-duplicity",
|
"last_opened_file_path": "/store/Documents/Workspaces/Steffo99/docker-backup-duplicity",
|
||||||
"node.js.detected.package.eslint": "true",
|
"node.js.detected.package.eslint": "true",
|
||||||
"node.js.detected.package.tslint": "true",
|
"node.js.detected.package.tslint": "true",
|
||||||
"node.js.selected.package.eslint": "(autodetect)",
|
"node.js.selected.package.eslint": "(autodetect)",
|
||||||
"node.js.selected.package.tslint": "(autodetect)",
|
"node.js.selected.package.tslint": "(autodetect)",
|
||||||
"nodejs_package_manager_path": "npm",
|
"nodejs_package_manager_path": "npm",
|
||||||
"project.structure.last.edited": "Modules",
|
"project.structure.last.edited": "Modules",
|
||||||
"project.structure.proportion": "0.0",
|
"project.structure.proportion": "0.0",
|
||||||
"project.structure.side.proportion": "0.2",
|
"project.structure.side.proportion": "0.2",
|
||||||
"settings.editor.selected.configurable": "editor.preferences.folding",
|
"settings.editor.selected.configurable": "editor.preferences.folding",
|
||||||
"vue.rearranger.settings.migration": "true"
|
"vue.rearranger.settings.migration": "true"
|
||||||
},
|
},
|
||||||
"keyToStringList": {
|
"keyToStringList": {
|
||||||
"GitStage.ChangesTree.GroupingKeys": [
|
"GitStage.ChangesTree.GroupingKeys": [
|
||||||
"directory",
|
"directory",
|
||||||
"module",
|
"module",
|
||||||
"repository"
|
"repository"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
}]]></component>
|
}</component>
|
||||||
<component name="SpellCheckerSettings" RuntimeDictionaries="0" Folders="0" CustomDictionaries="0" DefaultDictionary="application-level" UseSingleDictionary="true" transferred="true" />
|
<component name="SpellCheckerSettings" RuntimeDictionaries="0" Folders="0" CustomDictionaries="0" DefaultDictionary="application-level" UseSingleDictionary="true" transferred="true" />
|
||||||
<component name="TaskManager">
|
<component name="TaskManager">
|
||||||
<task active="true" id="Default" summary="Default task">
|
<task active="true" id="Default" summary="Default task">
|
||||||
|
@ -79,7 +79,7 @@
|
||||||
<workItem from="1684100629419" duration="1075000" />
|
<workItem from="1684100629419" duration="1075000" />
|
||||||
<workItem from="1684324347198" duration="751000" />
|
<workItem from="1684324347198" duration="751000" />
|
||||||
<workItem from="1684325989651" duration="719000" />
|
<workItem from="1684325989651" duration="719000" />
|
||||||
<workItem from="1684326731845" duration="82000" />
|
<workItem from="1684326731845" duration="241000" />
|
||||||
</task>
|
</task>
|
||||||
<task id="LOCAL-00001" summary="Add proper python cryptography requirements">
|
<task id="LOCAL-00001" summary="Add proper python cryptography requirements">
|
||||||
<created>1684080793392</created>
|
<created>1684080793392</created>
|
||||||
|
@ -109,7 +109,21 @@
|
||||||
<option name="project" value="LOCAL" />
|
<option name="project" value="LOCAL" />
|
||||||
<updated>1684326475873</updated>
|
<updated>1684326475873</updated>
|
||||||
</task>
|
</task>
|
||||||
<option name="localTasksCounter" value="5" />
|
<task id="LOCAL-00005" summary="Quote variables">
|
||||||
|
<created>1684326824058</created>
|
||||||
|
<option name="number" value="00005" />
|
||||||
|
<option name="presentableId" value="LOCAL-00005" />
|
||||||
|
<option name="project" value="LOCAL" />
|
||||||
|
<updated>1684326824058</updated>
|
||||||
|
</task>
|
||||||
|
<task id="LOCAL-00006" summary="Fix idea modules">
|
||||||
|
<created>1684326830505</created>
|
||||||
|
<option name="number" value="00006" />
|
||||||
|
<option name="presentableId" value="LOCAL-00006" />
|
||||||
|
<option name="project" value="LOCAL" />
|
||||||
|
<updated>1684326830505</updated>
|
||||||
|
</task>
|
||||||
|
<option name="localTasksCounter" value="7" />
|
||||||
<servers />
|
<servers />
|
||||||
</component>
|
</component>
|
||||||
<component name="TypeScriptGeneratedFilesManager">
|
<component name="TypeScriptGeneratedFilesManager">
|
||||||
|
@ -131,6 +145,8 @@
|
||||||
<MESSAGE value="Rename stage to "final"" />
|
<MESSAGE value="Rename stage to "final"" />
|
||||||
<MESSAGE value="Set a+x on backup.sh" />
|
<MESSAGE value="Set a+x on backup.sh" />
|
||||||
<MESSAGE value="Backup at startup" />
|
<MESSAGE value="Backup at startup" />
|
||||||
<option name="LAST_COMMIT_MESSAGE" value="Backup at startup" />
|
<MESSAGE value="Quote variables" />
|
||||||
|
<MESSAGE value="Fix idea modules" />
|
||||||
|
<option name="LAST_COMMIT_MESSAGE" value="Fix idea modules" />
|
||||||
</component>
|
</component>
|
||||||
</project>
|
</project>
|
27
backup.sh
27
backup.sh
|
@ -7,24 +7,9 @@ set -e
|
||||||
# It's duplicity's fault!
|
# It's duplicity's fault!
|
||||||
export PASSPHRASE=$(cat "${DUPLICITY_PASSPHRASE_FILE}")
|
export PASSPHRASE=$(cat "${DUPLICITY_PASSPHRASE_FILE}")
|
||||||
|
|
||||||
case "$MODE" in
|
echo "Launched in backup mode, performing backup..." >> /dev/stderr
|
||||||
backup)
|
duplicity \
|
||||||
echo "Launched in backup mode, performing backup..." >> /dev/stderr
|
--allow-source-mismatch \
|
||||||
duplicity \
|
--full-if-older-than "${DUPLICITY_FULL_IF_OLDER_THAN}" \
|
||||||
--allow-source-mismatch \
|
/mnt \
|
||||||
--full-if-older-than "${DUPLICITY_FULL_IF_OLDER_THAN}" \
|
"${DUPLICITY_TARGET_URL}"
|
||||||
/mnt \
|
|
||||||
"${DUPLICITY_TARGET_URL}"
|
|
||||||
;;
|
|
||||||
restore)
|
|
||||||
echo "Launched in restore mode, restoring backup..." >> /dev/stderr
|
|
||||||
duplicity \
|
|
||||||
--force \
|
|
||||||
--allow-source-mismatch \
|
|
||||||
"${DUPLICITY_TARGET_URL}" \
|
|
||||||
/mnt
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
echo "No such mode." >> /dev/stderr
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
|
|
|
@ -1,7 +1,17 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
echo "Running first backup..."
|
case "$MODE" in
|
||||||
./backup.sh
|
backup)
|
||||||
|
echo "Running first backup..."
|
||||||
echo "Running cron for daily backups..."
|
./backup.sh
|
||||||
crond -f -d 5 -l info
|
echo "Running cron for daily backups..."
|
||||||
|
crond -f -d 5 -l info
|
||||||
|
;;
|
||||||
|
restore)
|
||||||
|
echo "Restoring from latest backup..."
|
||||||
|
./restore.sh
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
echo "No such mode." >> /dev/stderr
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
15
restore.sh
Executable file
15
restore.sh
Executable file
|
@ -0,0 +1,15 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
# Get secrets from files
|
||||||
|
# Insecure, but there's not much I can do about it
|
||||||
|
# It's duplicity's fault!
|
||||||
|
export PASSPHRASE=$(cat "${DUPLICITY_PASSPHRASE_FILE}")
|
||||||
|
|
||||||
|
echo "Launched in restore mode, restoring backup..." >> /dev/stderr
|
||||||
|
duplicity \
|
||||||
|
--force \
|
||||||
|
--allow-source-mismatch \
|
||||||
|
"${DUPLICITY_TARGET_URL}" \
|
||||||
|
/mnt
|
Loading…
Reference in a new issue