mirror of
https://github.com/Sevichecc/pleroma-backup-script.git
synced 2025-04-30 00:39:30 +08:00
Refactor code struture
This commit is contained in:
parent
f72209fc63
commit
3b1c7a4a8d
1 changed files with 24 additions and 23 deletions
47
duplicacy.sh
47
duplicacy.sh
|
@ -1,31 +1,32 @@
|
|||
#!/usr/bin/expect
|
||||
#!/usr/bin/expect
|
||||
set ACCESS_KEY_ID "YOUR_ACCESS_KEY_ID"
|
||||
set SECRET_ACCESS_KEY "YOUR_SECRET_ACCESS_KEY"
|
||||
set PASSWORD "YOUR_PASSWORD"
|
||||
|
||||
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
|
||||
authenticate
|
||||
expect "completed"
|
||||
|
||||
expect "ID"
|
||||
send "$ACCESS_KEY_ID\r"
|
||||
# Run duplicacy prune command (optional)
|
||||
spawn duplicacy prune -keep 7:30
|
||||
authenticate
|
||||
|
||||
expect "Secret"
|
||||
send "$SECRET_ACCESS_KEY\r"
|
||||
|
||||
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
|
||||
# Allow user interaction after script completion
|
||||
interact
|
Loading…
Reference in a new issue