-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathrun.sh
More file actions
74 lines (67 loc) · 1.29 KB
/
Copy pathrun.sh
File metadata and controls
74 lines (67 loc) · 1.29 KB
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
CurPath=$(pwd)
#CurPath=/usr/local/ar4/rtsp
Bin=$2
Conf=$3
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:./lib_run
retval=0
#---------------------------------------------------------------------------
# START
#---------------------------------------------------------------------------
Start()
{
if [ $( pidof -s ${Bin} ) ]; then
echo -n "${Bin} process [${prog}] already running"
echo_failure
echo
return -1;
fi
if [ ! -x ./${Bin} ]; then
echo -n "${Bin} binary [${prog}] not found."
echo_failure
echo
return -1
fi
echo -n "Starting Dync Server(${Bin}): "
${CurPath}/${Bin} ${CurPath}/${Conf} & 2> /dev/null
retval=$?
if [ ${retval} == 0 ]; then
echo_success
echo
else
echo_failure
echo
break
fi
sleep 1
#cd -
return 0
}
#---------------------------------------------------------------------------
# STOP
#---------------------------------------------------------------------------
Stop()
{
echo -n "Stopping Dync Server(${Bin}): "
pkill ${Bin}
echo
return 0
}
#---------------------------------------------------------------------------
# MAIN
#---------------------------------------------------------------------------
case "$1" in
start)
Start
;;
stop)
Stop
;;
restart)
Stop
# sleep 5
Start
;;
*)
echo "Usage: $0 {start|stop|restart}"
esac
exit 0