forked from katharostech/docker_lizardfs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
docker-entrypoint.sh
executable file
·56 lines (46 loc) · 1.49 KB
/
docker-entrypoint.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
#!/bin/bash
if [ $DEBUG = "true" ]; then set -x; fi
usage_message="usage: docker run kadimasolutions/lizardfs [master|metalogger|chunkserver|cgiserver|client]"
# Configure LizardFS
if [ ! "$SKIP_CONFIGURE" = "true" ]; then
/configure.sh $@
fi
if [ "$1" = "master" ]; then
extra_options=""
if [ "$2" = "ha" ]; then
echo "Starting uRaft"
lizardfs-uraft -d
extra_options="-o ha-cluster-managed -o initial-personality=${3-master}"
fi
echo "Starting LizardFS master"
exec mfsmaster $extra_options -d
elif [ "$1" = "metalogger" ]; then
echo "Starting LizardFS Metalogger"
exec mfsmetalogger -d
elif [ "$1" = "chunkserver" ]; then
echo "Starting LizardFS Chunkserver"
exec mfschunkserver -d
elif [ "$1" = "cgiserver" ]; then
echo "Starting LizardFS CGI Server"
exec lizardfs-cgiserver -v -P ${2-80}
elif [ "$1" = "client" ]; then
if [ "$2" = "--help" -o "$2" = "-h" ]; then
echo "Displaying help for 'mfsmount'"
exec mfsmount --help
fi
echo "Mounting filesystem using LizardFS client"
mountpoint=${2:-/mnt/mfs}
mkdir -p $mountpoint
mfsmount $mountpoint ${@:3}
if [ $? -eq 0 ]; then
trap "echo 'Termination signal caught: Unmounting and exiting.'; umount $mountpoint; exit \$?" SIGTERM SIGINT
while true; do sleep 1; done
else
exit 1
fi
elif [ "$1" = "--help" -o "$1" = "-h" ]; then
echo $usage_message
else
echo "Unknown option -- $@"
echo $usage_message
fi