forked from free5gc/free5gc
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathforce_kill.sh
executable file
·55 lines (49 loc) · 1.23 KB
/
force_kill.sh
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
#!/bin/bash
DROP_ALL_DB=0
DB_NAME="free5gc"
DB_DROP_COLLECTION=(
"NfProfile"
"applicationData.influenceData.subsToNotify"
"applicationData.subsToNotify"
"policyData.subsToNotify"
"exposureData.subsToNotify"
)
if [ $# -ne 0 ]; then
while [ $# -gt 0 ]; do
case $1 in
-db)
DROP_ALL_DB=1
;;
esac
shift
done
fi
NF_LIST="nrf amf smf udr pcf udm nssf ausf n3iwf upf chf nef tngf"
for NF in ${NF_LIST}; do
sudo killall -9 ${NF}
done
sudo killall tcpdump
sudo ip link del upfgtp
sudo ip link del ipsec0
XFRMI_LIST=($(ip link | grep xfrmi | awk -F'[:,@]' '{print $2}'))
for XFRMI_IF in "${XFRMI_LIST[@]}"
do
sudo ip link del $XFRMI_IF
done
sudo rm /dev/mqueue/*
sudo rm -f /tmp/free5gc_unix_sock
sudo rm -f cert/*_*
sudo rm -f test/cert/*_*
sudo rm -f /tmp/config.json # CHF ChargingGatway FTP config
if [ $DROP_ALL_DB -eq 1 ]; then
mongo --eval "db.dropDatabase()" "$DB_NAME"
mongosh --eval "db.dropDatabase()" "$DB_NAME"
else
MONGO_SCRIPT=""
for COLLECTION in "${DB_DROP_COLLECTION[@]}"
do
MONGO_SCRIPT+="db.$COLLECTION.drop();"
done
mongo "$DB_NAME" --eval "$MONGO_SCRIPT"
mongosh "$DB_NAME" --eval "$MONGO_SCRIPT"
fi