blob: 506dca24ee47097983437d2d6bb1d40a2d14cbbc (
plain)
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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
|
#!/bin/sh
#
# Copyright 2012 Samsung Electronics Co., Ltd
#
# Licensed under the Flora License, Version 1.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.tizenopensource.org/license
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
launch_provider()
{
RETRY_COUNT=0
while [ ! -f "/tmp/.stop.provider" ]; do
# PROVIDER_HEAP_MONITOR_START=false
# PROVIDER_DISABLE_CALL_OPTION=false
# PROVIDER_METHOD="shm", "pixmap", "file" (default = "file")
BUFMGR_LOCK_TYPE="once" BUFMGR_MAP_CACHE="true" /usr/bin/data-provider-master
let RETRY_COUNT=$RETRY_COUNT+1
if [ $RETRY_COUNT -gt 5 ]; then
echo "EXCEED THE MAXIMUM RETRY COUNT: $RETRY_COUNT (max 5)"
break;
fi
done
rm /tmp/.stop.provider
}
start ()
{
OLDPID=`ps ax | grep /usr/bin/data-provider-master | grep -v grep | awk '{print $1}'`
if [ x"$OLDPID" != x"" ]; then
echo $OLDPID is already running.
exit 0
fi
rm /tmp/.stop.provider
launch_provider &
}
stop ()
{
TMP=`which ps`
if [ $? -ne 0 ]; then
echo "'ps' is not exists"
exit 0
fi
TMP=`which grep`
if [ $? -ne 0 ]; then
echo "'grep' is not exists"
exit 0
fi
TMP=`which awk`
if [ $? -ne 0 ]; then
echo "'awk' is not exists"
exit 0
fi
if [ ! -f "/usr/bin/data-provider-master" ]; then
echo "Data provider master is not installed correctly";
exit 0;
fi
touch /tmp/.stop.provider
BIN_INODE=`stat -Lc "%i" /usr/bin/data-provider-master`
PID=`ps ax | grep 'data-provider-master' | awk '{print $1}'`
for I in $PID;
do
if [ ! -f "/proc/$I/exe" ]; then
continue;
fi
INODE=`stat -Lc "%i" /proc/$I/exe 2>/dev/null`
if [ x"$BIN_INODE" == x"$INODE" ]; then
echo "Send TERM to $I"
kill $I # Try to terminate a master which is launched already
break
fi
done
}
case "$1" in
start|"") start;;
stop) stop;;
restart) stop; start;;
esac
# End of a file
|