-
Notifications
You must be signed in to change notification settings - Fork 28
/
start-container.bash
54 lines (41 loc) · 815 Bytes
/
start-container.bash
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
#!/bin/bash
/bin/bash configure-exports.bash
echo $(cat /etc/exports)
is_process_running() {
if [[ -n $(pgrep $1) ]];
then
return 0
else
return 1
fi
}
stop_container() {
echo 'received SIGTERM'
/usr/sbin/rpc.nfsd 0
sleep 1
exit
}
trap stop_container SIGTERM
while :
do
if ! is_process_running 'rpcbind'; then
echo 'starting rpcbind'
/sbin/rpcbind -i
fi
if ! is_process_running 'rpc.statd'; then
echo 'starting rpc.statd'
/sbin/rpc.statd --no-notify --port 32765 --outgoing-port 32766
sleep .5
fi
if [[ ! -a /proc/fs/nfsd/threads ]]; then
echo 'starting rpc.nfsd'
echo $(pgrep 'nfsd')
/usr/sbin/rpc.nfsd -V3 -N2 -N4 -d 8
fi
if ! is_process_running 'rpc.mountd'; then
echo 'starting rpc.mountd'
/usr/sbin/rpc.mountd -V3 -N2 -N4 --port 32767
/usr/sbin/exportfs -ra
fi
sleep 5
done