forked from wangwei1237/shell
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathloadphp.sh
More file actions
executable file
·66 lines (57 loc) · 719 Bytes
/
loadphp.sh
File metadata and controls
executable file
·66 lines (57 loc) · 719 Bytes
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
#!/bin/bash
PHP_HOME="$HOME/local/php"
PHP_PIDFILE="$PHP_HOME/var/php-fpm.pid"
function start()
{
if [ -f $PHP_PIDFILE ]
then
stop
else
$PHP_HOME/sbin/php-fpm
fi
if [ $? -eq 0 ]
then
echo "start php success."
else
echo "start php failed."
fi
return $?
}
function stop()
{
if [ -f $PHP_PIDFILE ]
then
kill $(cat $PHP_PIDFILE)
fi
if [ $? -eq 0 ]
then
echo "stop php success."
else
echo "stop php failed."
fi
return $?
}
function restart()
{
stop
start
if [ $? -eq 0 ]
then
echo "restart php success."
else
echo "restart php failed."
fi
}
case "$1" in
start)
start
;;
stop)
stop
;;
restart)
restart
;;
*)
echo "Usage: $0 {start|stop|restart}"
esac