-
Notifications
You must be signed in to change notification settings - Fork 0
/
start.sh
56 lines (42 loc) · 855 Bytes
/
start.sh
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
#!/bin/bash
echo "Iniciando rotinas."
service cron restart
check_nginx() {
if ! pgrep nginx > /dev/null; then
echo "Falha ao iniciar webservice."
exit 1
else
echo "Webservice iniciou."
fi
}
check_php_fpm() {
if ! pgrep php-fpm > /dev/null; then
echo "Falha ao iniciar o PHP."
exit 1
else
echo "PHP iniciou."
fi
}
if [ ! -d /var/run/php ]; then
mkdir -p /var/run/php
chown -R www-data:www-data /var/run/php
fi
echo "Iniciando PHP..."
php-fpm &
sleep 3
check_php_fpm
sleep 3
echo "Testando configuração do webservice..."
nginx -t
if [ $? -ne 0 ]; then
echo "Configuração do webservice invalida."
exit 1
else
echo "Configuração valida do webservice."
fi
echo "Iniciando webservice..."
nginx -g "daemon off;" &
sleep 3
check_nginx
wait -n
exit $?