mirror of
https://github.com/Sevichecc/pleroma-backup-script.git
synced 2025-04-30 08:49:31 +08:00
Refactor code struture
This commit is contained in:
parent
f72209fc63
commit
3b1c7a4a8d
1 changed files with 24 additions and 23 deletions
45
duplicacy.sh
45
duplicacy.sh
|
@ -4,28 +4,29 @@ set SECRET_ACCESS_KEY "YOUR_SECRET_ACCESS_KEY"
|
||||||
set PASSWORD "YOUR_PASSWORD"
|
set PASSWORD "YOUR_PASSWORD"
|
||||||
|
|
||||||
set timeout -1
|
set timeout -1
|
||||||
|
|
||||||
|
# Function to handle authentication
|
||||||
|
proc authenticate {} {
|
||||||
|
global ACCESS_KEY_ID SECRET_ACCESS_KEY PASSWORD
|
||||||
|
|
||||||
|
expect "ID"
|
||||||
|
send "$ACCESS_KEY_ID\r"
|
||||||
|
|
||||||
|
expect "Secret"
|
||||||
|
send "$SECRET_ACCESS_KEY\r"
|
||||||
|
|
||||||
|
expect "password"
|
||||||
|
send "$PASSWORD\r"
|
||||||
|
}
|
||||||
|
|
||||||
|
# Run duplicacy backup command
|
||||||
spawn duplicacy backup -threads 4
|
spawn duplicacy backup -threads 4
|
||||||
|
authenticate
|
||||||
|
expect "completed"
|
||||||
|
|
||||||
expect "ID"
|
# Run duplicacy prune command (optional)
|
||||||
send "$ACCESS_KEY_ID\r"
|
spawn duplicacy prune -keep 7:30
|
||||||
|
authenticate
|
||||||
|
|
||||||
expect "Secret"
|
# Allow user interaction after script completion
|
||||||
send "$SECRET_ACCESS_KEY\r"
|
interact
|
||||||
|
|
||||||
expect "password"
|
|
||||||
send "$PASSWORD\r"
|
|
||||||
|
|
||||||
##### (optional) Keep a revision every 7 days for revisions older than 30 days
|
|
||||||
# expect "completed"
|
|
||||||
# spawn duplicacy prune -keep 7:30
|
|
||||||
|
|
||||||
# expect "ID"
|
|
||||||
# send "$ACCESS_KEY_ID\r"
|
|
||||||
|
|
||||||
# expect "Secret"
|
|
||||||
# send "$SECRET_ACCESS_KEY\r"
|
|
||||||
|
|
||||||
# expect "password"
|
|
||||||
# send "$PASSWORD\r"
|
|
||||||
|
|
||||||
expect eof
|
|
Loading…
Reference in a new issue