#!/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