-
Notifications
You must be signed in to change notification settings - Fork 24
/
pgvault.func
625 lines (492 loc) · 25 KB
/
pgvault.func
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
#!/bin/bash
#
# Title: PGBlitz (Reference Title File)
# Author(s): Admin9705
# URL: https://pgblitz.com - http://github.pgblitz.com
# GNU: General Public License v3.0
################################################################################
runningcheck() {
initial2
runcheck5=$(docker ps | grep ${program_var})
if [ "$runcheck5" != "" ]; then running=1; else running=0; fi
}
initial() {
rm -rf /var/plexguide/pgvault.output 1>/dev/null 2>&1
rm -rf /var/plexguide/pgvault.buildup 1>/dev/null 2>&1
rm -rf /var/plexguide/program.temp 1>/dev/null 2>&1
rm -rf /var/plexguide/app.list 1>/dev/null 2>&1
rm -rf /var/plexguide/pgvault.output 1>/dev/null 2>&1
touch /var/plexguide/pgvault.output
touch /var/plexguide/program.temp
touch /var/plexguide/app.list
touch /var/plexguide/pgvault.buildup
touch /var/plexguide/pgvault.output
touch /var/plexguide/rclone.size
space=$(cat /var/plexguide/data.location)
# To Get Used Space
used=$(df -h /opt/appdata/plexguide | tail -n +2 | awk '{print $3}')
# To Get All Space
capacity=$(df -h /opt/appdata/plexguide | tail -n +2 | awk '{print $2}')
# Percentage
percentage=$(df -h /opt/appdata/plexguide | tail -n +2 | awk '{print $5}')
}
initial2() {
path=$(cat /var/plexguide/server.hd.path)
tarlocation=$(cat /var/plexguide/data.location)
program_size=$(cat /var/plexguide/rclone.size)
program_var=$(cat /tmp/program_var)
server_id=$(cat /var/plexguide/server.id)
}
final() {
echo
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
read -p '✅ Process Complete! | PRESS [ENTER] ' typed </dev/tty
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
bash /opt/pgvault/pgvault.sh
exit
}
queued() {
echo
read -p "⛔️ ERROR - $typed Already Queued! | Press [ENTER] " typed </dev/tty
}
badserver() {
echo
read -p '⛔️ ERROR - Type an Exact Server Name | Press [ENTER] ' typed </dev/tty
}
#not used yet
rclonelist() {
ls -l /mnt/gdrive/plexguide/backup | grep "^d" | awk '{print $9}' >pgvault.serverlist
}
pgboxrecall() {
ls -p /opt/coreapps/apps | grep -v / >/var/plexguide/pgvault.apprecall
while read p; do
sed -i "/^$p\b/Id" /var/plexguide/pgvault.apprecall
done </opt/pgvault/exempt.list
while read p; do
sed -i "/^$p\b/Id" /var/plexguide/pgvault.apprecall
basename "$p" .yml >>/var/plexguide/pgvault.apprecall
done </var/plexguide/pgvault.apprecall
}
mathprime() {
### List Out Apps In Readable Order (One's Not Installed)
num=0
rm -rf /var/plexguide/program.temp 1>/dev/null 2>&1
while read p; do
echo -n $p >>/var/plexguide/program.temp
echo -n " " >>/var/plexguide/program.temp
num=$((num + 1))
if [ "$num" == 7 ]; then
num=0
echo " " >>/var/plexguide/program.temp
fi
done </var/plexguide/pgvault.apprecall
}
################################################ FOR BACKUP - START
apprecall() {
tree -d -L 1 /opt/appdata | awk '{print $2}' | tail -n +2 | head -n -2 >/var/plexguide/pgvault.apprecall
while read p; do
sed -i "/^$p\b/Id" /var/plexguide/pgvault.apprecall
done </opt/pgvault/exempt.list
### Blank Out Temp List
rm -rf /var/plexguide/program.temp && touch /var/plexguide/program.temp
mathprime
}
buildup() {
echo "$typed" >>/var/plexguide/pgvault.buildup
sed -i "/^$typed\b/Id" /var/plexguide/pgvault.apprecall
num=0
rm -rf /var/plexguide/pgvault.output 1>/dev/null 2>&1
while read p; do
echo -n $p >>/var/plexguide/pgvault.output
echo -n " " >>/var/plexguide/pgvault.output
if [ "$num" == 7 ]; then
num=0
echo " " >>/var/plexguide/pgvault.output
fi
done </var/plexguide/pgvault.buildup
mathprime
vaultbackup
}
################################################ FOR BACKUP - END
serverprime() {
tree -d -L 1 /mnt/gdrive/plexguide/backup | awk '{print $2}' | tail -n +2 | head -n -2 >/tmp/server.list
### List Out Apps In Readable Order (One's Not Installed)
num=0
rm -rf /var/plexguide/program.temp 1>/dev/null 2>&1
while read p; do
echo -n $p >>/var/plexguide/program.temp
echo -n " " >>/var/plexguide/program.temp
num=$((num + 1))
if [ "$num" == 7 ]; then
num=0
echo " " >>/var/plexguide/program.temp
fi
done </tmp/server.list
servers=$(cat /var/plexguide/program.temp)
server_id=$(cat /var/plexguide/server.id)
tee <<-EOF
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
🚀 PG Vault ~ Server Recall 📓 Reference: pgvault.pgblitz.com
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
📂 Current [${server_id}] & Prior Servers Detected:
$servers
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
[Z] Exit
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
EOF
read -p '🌍 Type Server Name | Press [ENTER]: ' server </dev/tty
echo $server >/tmp/server.select
if [[ "$server" == "exit" || "$server" == "Exit" || "$server" == "EXIT" || "$server" == "z" || "$server" == "Z" ]]; then exit; fi
current2=$(cat /tmp/server.list | grep "\<$server\>")
if [ "$current2" == "" ]; then
badserver
serverprime
fi
tempserver=$server
ls -l /mnt/gdrive/plexguide/backup/$tempserver | awk '{print $9}' | tail -n +2 >/var/plexguide/pgvault.restoreapps
### Blank Out Temp List
rm -rf /var/plexguide/pgvault.apprecall 1>/dev/null 2>&1
touch /var/plexguide/pgvault.apprecall
while read p; do
basename "$p" .tar >>/var/plexguide/pgvault.apprecall
done </var/plexguide/pgvault.restoreapps
### Blank Out Temp List
rm -rf /var/plexguide/program.temp 1>/dev/null 2>&1
touch /var/plexguide/program.temp
mathprime
}
buildup2() {
echo "$typed" >>/var/plexguide/pgvault.buildup
sed -i "/^$typed\b/Id" /var/plexguide/pgvault.apprecall
num=0
rm -rf /var/plexguide/pgvault.output 1>/dev/null 2>&1
while read p; do
echo -n $p >>/var/plexguide/pgvault.output
echo -n " " >>/var/plexguide/pgvault.output
if [ "$num" == 7 ]; then
num=0
echo " " >>/var/plexguide/pgvault.output
fi
done </var/plexguide/pgvault.buildup
mathprime
vaultrestore
}
################################################ FOR RESTORE - START
################################################ FOR RESTORE - END
######################################################## START - PG Vault Backup
backup_all_start() {
while read p; do
tee <<-EOF
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
PG Vault - Backing Up: $p
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
EOF
sleep 2.5
# Store Used Program
echo $p >/tmp/program_var
# Execute Main Program
backup_process
sleep 2
done </var/plexguide/pgvault.apprecall
final
}
backup_start() {
while read p; do
tee <<-EOF
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
PG Vault - Backing Up: $p
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
EOF
sleep 2.5
# Store Used Program
echo $p >/tmp/program_var
# Execute Main Program
backup_process
sleep 2
done </var/plexguide/pgvault.buildup
final
}
backup_process() {
initial2
#tee <<-EOF
#━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
#↘️ Determining Initial File Size - $program_var
#━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
#EOF
#size=$(du -sh --apparent-size /opt/appdata/$program_var | /usr/bin/awk '{print $1}')
#sleep 2
#echo "Initial File Size: $size"
#sleep 2
##### Stop Docker Container if Running
runningcheck
if [ "$running" == "1" ]; then
tee <<-EOF
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
↘️ Stopping Docker Container - $program_var
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
EOF
sleep 1
docker stop $program_var 1>/dev/null 2>&1
fi
###### Start the Backup Process - Backup Locally First
tee <<-EOF
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
↘️ Zipping Data Locally - $program_var
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
EOF
path=$(cat /var/plexguide/server.hd.path)
tarlocation=$(cat /var/plexguide/data.location)
server_id=$(cat /var/plexguide/server.id)
tar \
--warning=no-file-changed --ignore-failed-read --absolute-names --warning=no-file-removed \
--exclude-from=/opt/pgvault/exclude.list \
-C /opt/appdata/${program_var} -cvf /opt/appdata/plexguide/${program_var}.tar ./
#tar \
#--warning=no-file-changed --ignore-failed-read --absolute-names --warning=no-file-removed \
#--exclude-from=/opt/pgvault/exclude.list \
#-cfv ${program_var}.tar /opt/appdata/${program_var}
##### Restart Docker Application if was Running Prior
if [ "$running" == "1" ]; then
tee <<-EOF
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
↘️ Restarting Docker Application - $program_var
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
EOF
sleep 2
docker restart $program_var 1>/dev/null 2>&1
fi
###### Backing Up Files to GDrive
tee <<-EOF
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
↘️ Sending Zipped Data to Google Drive - $program_var
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
EOF
rclone --config /opt/appdata/plexguide/rclone.conf mkdir gdrive:/plexguide/backup/${server_id} 1>/dev/null 2>&1
rclone --config /opt/appdata/plexguide/rclone.conf \
--stats-one-line --stats 1s --progress \
moveto ${tarlocation}/${program_var}.tar \
gdrive:/plexguide/backup/${server_id}/${program_var}.tar \
-v --checksum --drive-chunk-size=64M --transfers=8
##### Remove File Incase
rm -rf ${tarlocation}/${program_var}.tar 1>/dev/null 2>&1
}
######################################################## END - PG Vault Backup
#
##################################################### START - PG Vault Restore
restore_all_start() {
while read p; do
tee <<-EOF
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
PG Vault - Restoring: $p
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
EOF
sleep 2.5
# Store Used Program
echo $p >/tmp/program_var
# Execute Main Program
restore_process
sleep 2
done </var/plexguide/pgvault.apprecall
final
}
restore_start() {
while read p; do
tee <<-EOF
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
PG Vault - Restoring: $p
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
EOF
sleep 2.5
# Store Used Program
echo $p >/tmp/program_var
# Execute Main Program
restore_process
sleep 2
done </var/plexguide/pgvault.buildup
final
}
restore_process() {
initial2
srecall=$(cat /tmp/server.select)
tee <<-EOF
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
↘️ Determining Initial File Size - $program_var
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
EOF
size=$(du -sh --apparent-size /mnt/gdrive/plexguide/backup/${srecall}/${program_var}.tar | /usr/bin/awk '{print $1}')
sleep 2
echo "Initial File Size: $size"
sleep 2
###### Backing Up Files to GDrive
tee <<-EOF
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
↘️ Downloading Data From Google Drive - $program_var
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
EOF
rclone --config /opt/appdata/plexguide/rclone.conf --stats-one-line \
--stats 1s --progress \
copy gdrive:/plexguide/backup/${srecall}/${program_var}.tar \
${tarlocation} \
-v --checksum --drive-chunk-size=64M --transfers=8
##### Stop Docker Container if Running
runningcheck
if [ "$running" == "1" ]; then
tee <<-EOF
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
↘️ Stopping Docker Container - $program_var
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
EOF
sleep 1
docker stop $program_var 1>/dev/null 2>&1
fi
###### Start the Backup Process - Backup Locally First
tee <<-EOF
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
↘️ UnZipping & Restoring Data - $program_var
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
EOF
mkdir -p "/opt/appdata/${program_var}"
rm -rf "/opt/appdata/${program_var}/*"
chown -R 1000:1000 "/opt/appdata/${program_var}"
chmod -R 775 "/opt/appdata/${program_var}"
tar -C /opt/appdata/${program_var} -xvf ${tarlocation}/${program_var}.tar
chown -R 1000:1000 "/opt/appdata/${program_var}"
chmod -R 775 "/opt/appdata/${program_var}"
##### Restart Docker Application if was Running Prior
if [ "$running" == "1" ]; then
tee <<-EOF
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
↘️ Restarting Docker Application - $program_var
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
EOF
sleep 2
docker restart $program_var 1>/dev/null 2>&1
fi
##### Remove File Incase
rm -rf ${tarlocation}/${program_var}.tar 1>/dev/null 2>&1
}
##################################################### END - PG Vault Restore
#
##################################################### START - Backup Interface
vaultbackup() {
### List Out Apps In Readable Order (One's Not Installed)
notrun=$(cat /var/plexguide/program.temp)
buildup=$(cat /var/plexguide/pgvault.output)
if [ "$buildup" == "" ]; then buildup="NONE"; fi
tee <<-EOF
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
🚀 PG Vault ~ Data Storage 📓 Reference: pgvault.pgblitz.com
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
📂 App Data available to Backup
$notrun
💾 Apps Queued for Backup
$buildup
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
[A] Backup
[Z] Exit
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
EOF
read -p '🌍 Type APP for QUEUE | Type all to backup all apps | Press [ENTER]: ' typed </dev/tty
if [[ "$typed" == "all" || "$typed" == "All" || "$typed" == "ALL" ]]; then
backup_all_start
fi
if [[ "$typed" == "backup" || "$typed" == "a" || "$typed" == "A" ]]; then backup_start; fi
if [[ "$typed" == "exit" || "$typed" == "Exit" || "$typed" == "EXIT" || "$typed" == "z" || "$typed" == "Z" ]]; then exit; fi
current2=$(cat /var/plexguide/pgvault.buildup | grep "\<$typed\>")
if [ "$current2" != "" ]; then
queued
vaultbackup
fi
cat /var/plexguide/pgvault.buildup >/tmp/appcheck.5
cat /var/plexguide/pgvault.apprecall >>/tmp/appcheck.5
current1=$(cat /tmp/appcheck.5 | grep "\<$typed\>")
if [ "$current1" == "" ]; then badinput && vaultbackup; fi
buildup
}
##################################################### END - Backup Interface
#
##################################################### START - Restore Interface
vaultrestore() {
notrun=$(cat /var/plexguide/program.temp)
buildup=$(cat /var/plexguide/pgvault.output)
if [ "$buildup" == "" ]; then buildup="NONE"; fi
tee <<-EOF
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
🚀 PG Vault ~ Data Recall 📓 Reference: pgvault.pgblitz.com
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
📂 App Data available to Restore
$notrun
💾 Apps Queued for Restore
$buildup
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
[A] Restore
[Z] Exit
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
EOF
read -p '🌍 Type APP for QUEUE | Type all to restore all apps | Press [ENTER]: ' typed </dev/tty
if [[ "$typed" == "all" || "$typed" == "All" || "$typed" == "ALL" ]]; then restore_all_start; fi
if [[ "$typed" == "restore" || "$typed" == "a" || "$typed" == "A" ]]; then restore_start; fi
if [[ "$typed" == "exit" || "$typed" == "Exit" || "$typed" == "EXIT" || "$typed" == "z" || "$typed" == "Z" ]]; then exit; fi
current2=$(cat /var/plexguide/pgvault.buildup | grep "\<$typed\>")
if [ "$current2" != "" ]; then
queued
vaultrestore
fi
cat /var/plexguide/pgvault.buildup >/tmp/appcheck.5
cat /var/plexguide/pgvault.apprecall >>/tmp/appcheck.5
current1=$(cat /tmp/appcheck.5 | grep "\<$typed\>")
if [ "$current1" == "" ]; then badinput && vaultrestore; fi
buildup2
}
##################################################### START Primary Interface
primaryinterface() {
initial2
tee <<-EOF
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
📁 PG Vault Interface ~ 📓 Reference: pgvault.pgblitz.com
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
🌵 PG Disk Used Space: $used of $capacity | $percentage Used Capacity
[1] Data Backup
[2] Data Restore
[3] Current Server ID : $server_id
[4] Processing Location: $tarlocation
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
[Z] Exit
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
EOF
read -p 'Type a Number | Press [ENTER]: ' typed </dev/tty
if [ "$typed" == "1" ]; then
vaultbackup
primaryinterface
elif [ "$typed" == "2" ]; then
serverprime
vaultrestore
primaryinterface
elif [ "$typed" == "3" ]; then
echo "0" >/var/plexguide/server.id.stored
bash /opt/plexguide/menu/interface/serverid.sh
primaryinterface
elif [ "$typed" == "4" ]; then
bash /opt/pgvault/location.sh
primaryinterface
elif [[ "$typed" == "Z" || "$typed" == "z" ]]; then
exit
else
badinput
primaryinterface
fi
}
##################################################### END Primary Interface
restorecheck() {
if [ "$restoreid" == "[NOT-SET]" ]; then
tee <<-EOF
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
⛔️ WARNING! - You Must Set Your Recovery ID First! Restarting Process!
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
EOF
read -n 1 -s -r -p "Press [ANY] Key to Continue "
echo
primaryinterface
exit
fi
}