mirror of
https://github.com/Steffo99/backup-duplicity.git
synced 2024-12-21 11:14:19 +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="showVisibilityIcons" value="true" />
|
||||
</component>
|
||||
<component name="PropertiesComponent"><![CDATA[{
|
||||
"keyToString": {
|
||||
"RunOnceActivity.ShowReadmeOnStart": "true",
|
||||
"git-widget-placeholder": "main",
|
||||
"last_opened_file_path": "/store/Documents/Workspaces/Steffo99/docker-backup-duplicity",
|
||||
"node.js.detected.package.eslint": "true",
|
||||
"node.js.detected.package.tslint": "true",
|
||||
"node.js.selected.package.eslint": "(autodetect)",
|
||||
"node.js.selected.package.tslint": "(autodetect)",
|
||||
"nodejs_package_manager_path": "npm",
|
||||
"project.structure.last.edited": "Modules",
|
||||
"project.structure.proportion": "0.0",
|
||||
"project.structure.side.proportion": "0.2",
|
||||
"settings.editor.selected.configurable": "editor.preferences.folding",
|
||||
"vue.rearranger.settings.migration": "true"
|
||||
<component name="PropertiesComponent">{
|
||||
"keyToString": {
|
||||
"RunOnceActivity.ShowReadmeOnStart": "true",
|
||||
"git-widget-placeholder": "main",
|
||||
"last_opened_file_path": "/store/Documents/Workspaces/Steffo99/docker-backup-duplicity",
|
||||
"node.js.detected.package.eslint": "true",
|
||||
"node.js.detected.package.tslint": "true",
|
||||
"node.js.selected.package.eslint": "(autodetect)",
|
||||
"node.js.selected.package.tslint": "(autodetect)",
|
||||
"nodejs_package_manager_path": "npm",
|
||||
"project.structure.last.edited": "Modules",
|
||||
"project.structure.proportion": "0.0",
|
||||
"project.structure.side.proportion": "0.2",
|
||||
"settings.editor.selected.configurable": "editor.preferences.folding",
|
||||
"vue.rearranger.settings.migration": "true"
|
||||
},
|
||||
"keyToStringList": {
|
||||
"GitStage.ChangesTree.GroupingKeys": [
|
||||
"directory",
|
||||
"module",
|
||||
"repository"
|
||||
"keyToStringList": {
|
||||
"GitStage.ChangesTree.GroupingKeys": [
|
||||
"directory",
|
||||
"module",
|
||||
"repository"
|
||||
]
|
||||
}
|
||||
}]]></component>
|
||||
}</component>
|
||||
<component name="SpellCheckerSettings" RuntimeDictionaries="0" Folders="0" CustomDictionaries="0" DefaultDictionary="application-level" UseSingleDictionary="true" transferred="true" />
|
||||
<component name="TaskManager">
|
||||
<task active="true" id="Default" summary="Default task">
|
||||
|
@ -79,7 +79,7 @@
|
|||
<workItem from="1684100629419" duration="1075000" />
|
||||
<workItem from="1684324347198" duration="751000" />
|
||||
<workItem from="1684325989651" duration="719000" />
|
||||
<workItem from="1684326731845" duration="82000" />
|
||||
<workItem from="1684326731845" duration="241000" />
|
||||
</task>
|
||||
<task id="LOCAL-00001" summary="Add proper python cryptography requirements">
|
||||
<created>1684080793392</created>
|
||||
|
@ -109,7 +109,21 @@
|
|||
<option name="project" value="LOCAL" />
|
||||
<updated>1684326475873</updated>
|
||||
</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 />
|
||||
</component>
|
||||
<component name="TypeScriptGeneratedFilesManager">
|
||||
|
@ -131,6 +145,8 @@
|
|||
<MESSAGE value="Rename stage to "final"" />
|
||||
<MESSAGE value="Set a+x on backup.sh" />
|
||||
<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>
|
||||
</project>
|
27
backup.sh
27
backup.sh
|
@ -7,24 +7,9 @@ set -e
|
|||
# It's duplicity's fault!
|
||||
export PASSPHRASE=$(cat "${DUPLICITY_PASSPHRASE_FILE}")
|
||||
|
||||
case "$MODE" in
|
||||
backup)
|
||||
echo "Launched in backup mode, performing backup..." >> /dev/stderr
|
||||
duplicity \
|
||||
--allow-source-mismatch \
|
||||
--full-if-older-than "${DUPLICITY_FULL_IF_OLDER_THAN}" \
|
||||
/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
|
||||
echo "Launched in backup mode, performing backup..." >> /dev/stderr
|
||||
duplicity \
|
||||
--allow-source-mismatch \
|
||||
--full-if-older-than "${DUPLICITY_FULL_IF_OLDER_THAN}" \
|
||||
/mnt \
|
||||
"${DUPLICITY_TARGET_URL}"
|
||||
|
|
|
@ -1,7 +1,17 @@
|
|||
#!/bin/sh
|
||||
|
||||
echo "Running first backup..."
|
||||
./backup.sh
|
||||
|
||||
echo "Running cron for daily backups..."
|
||||
crond -f -d 5 -l info
|
||||
case "$MODE" in
|
||||
backup)
|
||||
echo "Running first backup..."
|
||||
./backup.sh
|
||||
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