-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathservice.sh
69 lines (51 loc) · 1.06 KB
/
service.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
69
#!/bin/sh
#
# Minio S3
prog_dir=`dirname \`realpath $0\``
name="minio"
version="18"
logfile="/tmp/DroboApps/${name}/minio.log"
pidfile="/tmp/DroboApps/${name}/pid.txt"
miniostorage="/mnt/DroboFS/Shares/Public/MinioS3/"
# args: $1 = pidfile
# return: $? = 0 if running, 1 if not
_is_running() {
/bin/ps | /bin/grep minio &> /dev/null
}
_mount_tmp() {
grep -q ^tmpfs /proc/mounts 2> /dev/null
if [ $? -ne 0 ]; then
mount -t tmpfs tmpfs /tmp 1> /dev/null 2>&1
fi
mkdir -p `dirname ${pidfile}` 1> /dev/null 2>&1
}
start_service() {
#_mount_tmp
#"${prog_dir}/sbin/minio" server ${miniostorage} -C ${prog_dir}/etc/ --quiet 1>> ${logfile} 2>&1
"${prog_dir}/sbin/minio" server ${miniostorage} -C ${prog_dir}/etc/ --quiet &
}
stop_service() {
/usr/bin/killall minio
}
status() {
/bin/cat ${prog_dir}minio.log
}
case "$1" in
start)
start_service
;;
stop)
stop_service
;;
restart)
stop_service
start_service
;;
status)
status
;;
*)
echo "Usage: $0 [start|stop|restart|status]"
exit 1
;;
esac