-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathopen5gs_tool.sh
executable file
·68 lines (57 loc) · 1.24 KB
/
open5gs_tool.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
56
57
58
59
60
61
62
63
64
65
66
67
68
#!/bin/sh
NFLIST="amf ausf bsf hss mme nrf nssf pcf pcrf scp sgwc sgwu smf udm udr upf"
dostart() {
for nf in $NFLIST; do
echo systemctl start open5gs-${nf}d
done
}
dostatus() {
for nf in $NFLIST; do
echo systemctl status open5gs-${nf}d
done
}
dostop() {
for nf in $NFLIST; do
echo systemctl stop open5gs-${nf}d
done
}
dorestart() {
for nf in $NFLIST; do
echo systemctl restart open5gs-${nf}d
done
}
dodisable() {
for nf in $NFLIST; do
echo systemctl disable open5gs-${nf}d
done
}
doenable() {
for nf in $NFLIST; do
echo systemctl enable open5gs-${nf}d
done
}
dosetup() {
for nf in $NFLIST; do
file="/lib/systemd/system/open5gs-${nf}d.service"
rm "$file"
touch "$file"
echo "[Unit]" >> $file
echo "Description=Open5GS ${nf}" >> $file
echo "[Service]" >> $file
echo "WorkingDirectory=/root/open5gs/install/bin" >> $file
echo "ExecStart=/root/open5gs/install/bin/open5gs-${nf}d -c /etc/open5gs/${nf}.yaml" >> $file
echo "Restart=always" >> $file
echo "RestartSec=2" >> $file
echo "[Install]" >> $file
echo "WantedBy=multi-user.target" >> $file
done
}
case $1 in
start) dostart ;;
status) dostatus;;
stop) dostop ;;
restart) dorestart ;;
disable) dodisable ;;
enable) doenable ;;
setup) dosetup;;
esac