-
Notifications
You must be signed in to change notification settings - Fork 0
/
start-wordpress
executable file
·41 lines (35 loc) · 1.36 KB
/
start-wordpress
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
#!/bin/bash
set -e
if [ "${AUTHORIZED_KEYS}" != "**None**" ]; then
echo "=> start-wordpress - Found authorized keys"
mkdir -p /root/.ssh
chmod 700 /root/.ssh
touch /root/.ssh/authorized_keys
chmod 600 /root/.ssh/authorized_keys
IFS=$'\n'
arr=$(echo ${AUTHORIZED_KEYS} | tr "," "\n")
for x in $arr
do
x=$(echo $x |sed -e 's/^ *//' -e 's/ *$//')
cat /root/.ssh/authorized_keys | grep "$x" >/dev/null 2>&1
if [ $? -ne 0 ]; then
echo "••• `date` - => start-wordpress - Adding public key to /root/.ssh/authorized_keys: $x"
echo "$x" >> /root/.ssh/authorized_keys
fi
done
fi
if [ ! -f /.root_pw_set ]; then
echo "••• `date` - start-wordpress - Estabelecendo a senha de root para o SSH "
/set_root_pw.sh "$ROOT_PASSWORD"
fi
if [ -f /.root_pw_set ]; then
echo "••• `date` - start-wordpress - Senha de root para o SSH já foi definida"
fi
echo "••• `date` - - - - - - start-wordpress - Iniciando o SSH Server - - - - - - - - - "
/usr/sbin/sshd -D &
echo "••• `date` - - - - - - start-wordpress - SSH Server Iniciado - - - - - - - - "
# O Apache não se comporta muito bem com arquivos PID de sessões anteriores
rm -f /var/run/apache2/apache2.pid
echo "••• `date` - start-wordpress - Apache vai iniciar "
/usr/local/bin/apache2-foreground
echo "••• `date` - start-wordpress - Apache terminou "