-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathdelete_inventory.sh
More file actions
executable file
·71 lines (59 loc) · 1.29 KB
/
delete_inventory.sh
File metadata and controls
executable file
·71 lines (59 loc) · 1.29 KB
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
#! /bin/bash
# This script will delete all inventory objects and attached records (loans, bound-with-parts, etc.)
# You will be prompted before delete SRS since this operation will delete not only bibs but also
# authority records.
if [ ! $1 ]
then
echo "Usage: $0 <tenant>"
exit
fi
L='------------------------------------'
GO=`grep "tenant\": \"$1\"" config.json`
if [ "$GO" ]
then
EP=inventory-storage/bound-with-parts
echo $L
echo "Deleting from $EP..."
echo $L
node deleteByEndpoint $EP
EP=instance-storage/instance-relationships
echo $L
echo "Deleting from $EP..."
echo $L
node deleteByEndpoint $EP
EP=preceding-succeeding-titles
echo $L
echo "Deleting from $EP..."
echo $L
node deleteByEndpoint $EP
echo $L
echo "Deleting all loans..."
echo $L
node deleteAllLoans $1
echo $L
echo "Deleting all items..."
echo $L
node deleteAllItems $1
echo $L
echo "Deleting all holdings..."
echo $L
node deleteAllHoldings $1
echo $L
echo "Deleting all instances..."
echo $L
node deleteAllInstances $1
echo $L
read -n 1 -p "Do you want to delete all SRS? (y/n): " YN
if [ $YN == y ]
then
echo
echo "Deleting all source storage snapshots..."
node deleteSnapshotsAndRecords $1
fi
echo
echo $L
echo Done!
echo $L
else
echo "ERROR \"$1\" does't match config tenant!"
fi