-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathnginx-php.sh
More file actions
executable file
·76 lines (75 loc) · 2.47 KB
/
nginx-php.sh
File metadata and controls
executable file
·76 lines (75 loc) · 2.47 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
75
76
#!/bin/bash
NGINX="/usr/local/sbin/nginx"
PHPFPM="/usr/local/sbin/php-fpm"
GEARMAN="/usr/local/sbin/gearmand"
PIDPATH="/usr/local/var/run"
LOGPATH="/usr/local/var/log"
if [[ $1 = "start" ]]; then
echo "Start gearmand ..."
gearmand --queue-type mysql --mysql-user root --mysql-password 12121212 --mysql-db default --mysql-table gearman_queue -P $PIDPATH/gearmand.pid -l $LOGPATH/gearmand.log -d --verbose DEBUG
echo "Start php-fpm ..."
sudo $PHPFPM -D
echo "Start nginx ..."
sudo $NGINX
echo "Done!"
elif [[ $1 = "stop" ]]; then
echo "Stopping gearmand ..."
kill -9 `cat $PIDPATH/gearmand.pid`
echo "Stopping nginx ..."
sudo kill `cat $PIDPATH/nginx.pid`
echo "Stopping php-fpm ..."
sudo kill `cat $PIDPATH/php-fpm.pid`
echo "Done!"
elif [[ $1 = "restart" ]]; then
echo "Stopping gearmand ..."
kill -9 `cat $PIDPATH/gearmand.pid`
echo "Stopping nginx ..."
sudo kill `cat $PIDPATH/nginx.pid`
echo "Stopping php-fpm ..."
sudo kill `cat $PIDPATH/php-fpm.pid`
echo "Start gearmand ..."
gearmand --queue-type mysql --mysql-user root --mysql-password 12121212 --mysql-db default --mysql-table gearman_queue -P $PIDPATH/gearmand.pid -l $LOGPATH/gearmand.log -d --verbose DEBUG
echo "Start php-fpm ..."
sudo $PHPFPM -D
echo "Start nginx ..."
sudo $NGINX
echo "Done!"
elif [[ $1 = "nginx" ]]; then
if [[ $2 = "start" ]]; then
echo "Start nginx ..."
sudo $NGINX
echo "Done!"
elif [[ $2 = "stop" ]]; then
echo "Stopping nginx ..."
sudo kill `cat $PIDPATH/nginx.pid`
echo "Done!"
elif [[ $2 = "restart" ]]; then
echo "Stopping nginx ..."
sudo kill `cat $PIDPATH/nginx.pid`
echo "Start nginx ..."
sudo $NGINX
echo "Done!"
fi
elif [[ $1 = "php" ]] || [[ $1 = "php-fpm" ]]; then
if [[ $2 = "start" ]]; then
echo "Start php-fpm ..."
sudo $PHPFPM -D
echo "Done!"
elif [[ $2 = "stop" ]]; then
echo "Stopping php-fpm ..."
sudo kill `cat $PIDPATH/php-fpm.pid`
echo "Done!"
elif [[ $2 = "restart" ]]; then
echo "Stopping php-fpm ..."
sudo kill `cat $PIDPATH/php-fpm.pid`
echo "Start php-fpm ..."
sudo $PHPFPM -D
echo "Done!"
fi
else
echo "Valid commands: "
echo "start | stop | restart"
echo "------------------------------------"
echo "nginx (start | stop | restart)"
echo "php | php-fpm (start | stop | restart)"
fi