-
Notifications
You must be signed in to change notification settings - Fork 7
/
install.sh
431 lines (371 loc) · 17.3 KB
/
install.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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
#!/bin/bash
set -e
RELEASE_FILE=/etc/os-release
OS=$(egrep '^(NAME)=' $RELEASE_FILE | tr -d '"' | tr -d 'NAME' | tr -d '=')
WORK_PATH=/var/www
MYSQL_AUTH_FILE=/var/www/mysql_auth
CURRENT_USER=$(whoami)
# choosing ACTION
echo -e "\e[33mSelect action: \nI - add new website;\nR - remove website;\nS - generate SSL letsencrypt for website;\nF - create FTP account to website;\nD - delete FTP account from website;\e[39m"
read ACTION
until [[ $PHP_VERSION != "I" || $PHP_VERSION != "R" || $PHP_VERSION != "S" || $PHP_VERSION != "F" || $PHP_VERSION != "D" ]]
do
echo -e "\e[33mSelect action: \nI - add new website;\nR - remove website;\nS - generate SSL letsencrypt for website;\nF - create FTP account to website;\nD - delete FTP account from website;\e[39m"
read ACTION
done
if [[ $ACTION == "I" ]]
then
#checking OS
echo -e "\e[33mChecking OS \e[39m"
if [[ $OS != "Ubuntu" ]]
then
echo -e "\e[31m OS must be Ubuntu 18.04 \e[39m" EXIT
else
echo -e "\e[32m OS is Ubuntu \e[39m"
fi
#checking is git installed
echo -e "\e[33mChecking GIT \e[39m"
if hash git > /dev/null 2>&1
then
echo -e "\e[32m GIT installed \e[39m"
else
echo -e "\e[31m GIT not installed, install started \e[39m" && apt-get install -y git > /dev/null 2>&1
fi
#checking is docker installed
echo -e "\e[33mChecking DOCKER \e[39m"
if hash docker > /dev/null 2>&1
then
echo -e "\e[32m DOCKER installed \e[39m"
else
echo -e "\e[31m DOCKER not installed, install started \e[39m" && cd /usr/local/src && wget -qO- https://get.docker.com/ | sh > /dev/null 2>&1
fi
#checking is installed docker-compose
echo -e "\e[33mChecking DOCKER-COMPOSE \e[39m"
if hash docker-compose > /dev/null 2>&1
then
echo -e "\e[32m DOCKER-COMPOSE installed \e[39m"
else
echo -e "\e[31m DOCKER-COMPOSE not installed, install started \e[39m" && curl -L "https://github.com/docker/compose/releases/download/1.25.4/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose && chmod +x /usr/local/bin/docker-compose && source ~/.bashrc > /dev/null 2>&1
fi
#checking is pure-ftpd installed
echo -e "\e[33mChecking FTP \e[39m"
if hash pure-ftpd > /dev/null 2>&1
then
echo -e "\e[32m FTP installed \e[39m"
else
echo -e "\e[31m FTP not installed, install started \e[39m"
if ! id -u ftpuser > /dev/null 2>&1; then
useradd -g www-data -d /home/ftpuser -m -s /bin/false ftpuser > /dev/null 2>&1
fi
apt-get install pure-ftpd -y > /dev/null 2>&1 && \
apt-get install mysql-client -y > /dev/null 2>&1 && \
systemctl start pure-ftpd.service > /dev/null 2>&1 && \
systemctl enable pure-ftpd.service > /dev/null 2>&1 && \
cd /etc/pure-ftpd/ && \
mv pure-ftpd.conf pure-ftpd.conf.old && \
wget https://raw.githubusercontent.com/darbit-ru/bitrix_docker/master/pure-ftpd.conf > /dev/null 2>&1 && \
ufw allow from any to any port 20,21,30000:50000 proto tcp > /dev/null 2>&1 && \
touch /etc/pure-ftpd/pureftpd.passwd && \
pure-pw mkdb > /dev/null 2>&1 && \
ln -s /etc/pure-ftpd/conf/PureDB /etc/pure-ftpd/auth/50pure && \
echo yes > /etc/pure-ftpd/conf/ChrootEveryone && \
systemctl restart pure-ftpd.service && \
chown -R ftpuser:www-data /var/www && \
chmod 2775 /var/www && \
chmod -R o+r /var/www > /dev/null 2>&1 && \
chmod -R g+w /var/www > /dev/null 2>&1 && \
find /var/www -type d -exec chmod 2775 {} + > /dev/null 2>&1 && \
find /var/www -type f -exec chmod 0664 {} + > /dev/null 2>&1 && \
usermod -a -G www-data $CURRENT_USER
fi
#show message that all required packets installed
echo -e "\n\e[32mAll required packets installed \e[39m\n\n"
# downloading docker from git source
DOCKER_FOLDER_PATH=$WORK_PATH/bitrix_docker
if [ ! -d "$DOCKER_FOLDER_PATH" ]
then
echo -e "\e[33mDocker containers is not installed. Installation starting... \e[39m\n"
cd $WORK_PATH && \
git clone https://github.com/darbit-ru/bitrix_docker.git && \
cd /var/ && chmod -R 775 www/ && chown -R ftpuser:www-data www/ && \
cd $DOCKER_FOLDER_PATH
echo -e "\n\e[33mCopy environment setting file and starting configuration \e[39m"
cp -f .env_template .env && \
echo -e "\e[32mDone \e[39m\n"
# chosing PHP version
echo -e "\e[33mSelect PHP version [5.6, 7.1, 7.4]: \e[39m"
read PHP_VERSION
until [[ $PHP_VERSION != "5.6" || $PHP_VERSION != "7.1" || $PHP_VERSION != "7.4" ]]
do
echo -e "\e[33mSelect PHP version [5.6, 7.1, 7.4]: \e[39m"
read PHP_VERSION
done
SELECTED_PHP_VERSION=php71
if [[ $PHP_VERSION == "5.6" ]]; then
SELECTED_PHP_VERSION=php56
elif [[ $PHP_VERSION == "7.4" ]]; then
SELECTED_PHP_VERSION=php74
fi
sed -i "s/#PHP_VERSION#/$SELECTED_PHP_VERSION/g" $DOCKER_FOLDER_PATH/.env
# chosing MYSQL version
echo -e "\e[33mSelect MYSQL version [5.7, 8.0]: \e[39m"
read MYSQL_VERSION
until [[ $MYSQL_VERSION != "5.7" || $MYSQL_VERSION != "8.0" ]]
do
echo -e "\e[33mSelect MYSQL version [5.7, 8.0]: \e[39m"
read MYSQL_VERSION
done
SELECTED_MYSQL_VERSION=mysql57
if [[ $MYSQL_VERSION == "8.0" ]]; then
SELECTED_MYSQL_VERSION=mysql80
fi
sed -i "s/#DB_SERVER_TYPE#/$SELECTED_MYSQL_VERSION/g" $DOCKER_FOLDER_PATH/.env
# set database root password
echo -e "\e[33mSet MYSQL database ROOT PASSWORD: \e[39m"
read MYSQL_DATABASE_ROOT_PASSWORD
until [[ ! -z "$MYSQL_DATABASE_ROOT_PASSWORD" ]]
do
echo -e "\e[33mSet MYSQL database ROOT PASSWORD: \e[39m"
read MYSQL_DATABASE_ROOT_PASSWORD
done
sed -i "s/#DATABASE_ROOT_PASSWORD#/$MYSQL_DATABASE_ROOT_PASSWORD/g" $DOCKER_FOLDER_PATH/.env
echo -e "[client]\nuser=root\npassword="$MYSQL_DATABASE_ROOT_PASSWORD > $MYSQL_AUTH_FILE
echo -e "\n\e[32mStarting DOCKER containers \e[39m\n"
docker-compose up -d
else
cd $DOCKER_FOLDER_PATH
echo -e "\n\e[32mStarting DOCKER containers \e[39m\n"
docker-compose up -d
systemctl start pure-ftpd.service
fi
#checking site name domain
echo -e "\n\n\e[33mEnter site name (websitename.domain | example: mail.ru): \e[39m"
read SITE_NAME
domainRegex="(^([a-zA-Z0-9](([a-zA-Z0-9-]){0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{0,10}$)"
until [[ $SITE_NAME =~ $domainRegex ]]
do
echo -e "\e[33mEnter site name (websitename.domain | example: mail.ru): \e[39m"
read SITE_NAME
done
#checking is site directory exist
WORK_PATH_WEBSITE=$WORK_PATH"/bitrix/"
if [ ! -d "$WORK_PATH_WEBSITE" ]
then
mkdir -p $WORK_PATH/bitrix/
fi
WEBSITE_FILES_PATH=$WORK_PATH/bitrix/$SITE_NAME
if [ ! -d "$WEBSITE_FILES_PATH" ]
then
#checking site installation type
echo -e "\e[33mSite installation type? (C - clear install bitrixsetup.php / R - restore from backup): \e[39m"
read INSTALLATION_TYPE
until [[ $INSTALLATION_TYPE == [CR] ]]
do
echo -e "\e[33mSite installation type? (C - clear install bitrixsetup.php / R - restore from backup): \e[39m"
read INSTALLATION_TYPE
done
#checking site installation type
echo -e "\e[33mDo you want install SSL from letsencrypt? (Y/N): \e[39m"
read SSL_INSTALL_ACTION
until [[ $SSL_INSTALL_ACTION != "Y" || $SSL_INSTALL_ACTION != "N" ]]
do
echo -e "\e[33mDo you want install SSL from letsencrypt? (Y/N): \e[39m"
read SSL_INSTALL_ACTION
done
echo -e "\e[33mCreating website folder \e[39m"
mkdir -p $WEBSITE_FILES_PATH && \
cd $WEBSITE_FILES_PATH && \
if [[ $INSTALLATION_TYPE == "C" ]]; then wget http://www.1c-bitrix.ru/download/scripts/bitrixsetup.php; elif [[ $INSTALLATION_TYPE == "R" ]]; then wget http://www.1c-bitrix.ru/download/scripts/restore.php; fi && \
cd /var/ && chmod -R 775 www/ && chown -R ftpuser:www-data www/
echo -e "\n\e[33mConfiguring NGINX conf file \e[39m"
cp -f $DOCKER_FOLDER_PATH/nginx/conf/default.conf_template $DOCKER_FOLDER_PATH/nginx/conf/conf.d/$SITE_NAME.conf && \
sed -i "s/#SITE_NAME#/$SITE_NAME/g" $DOCKER_FOLDER_PATH/nginx/conf/conf.d/$SITE_NAME.conf && \
sed -i "s|#SITE_PATH#|$WEBSITE_FILES_PATH|g" $DOCKER_FOLDER_PATH/nginx/conf/conf.d/$SITE_NAME.conf && \
echo -e "\e[32mDone \e[39m\n"
cd $DOCKER_FOLDER_PATH && \
docker-compose stop web_server && \
docker-compose rm -f web_server && \
docker-compose build web_server && \
docker-compose up -d
if [[ $SSL_INSTALL_ACTION == "Y" ]]
then
echo -e "\n\e[33mPrepare to sending request to generate certificate for domains - $SITE_NAME, www.$SITE_NAME (Attention! Be sure that domain www.$SITE_NAME is correctly setup in domain control panel with A or CNAME dns record) \e[39m"
echo -e "\e[33mIs domains settings correct setup in domain control panel? (Y/N): \e[39m"
read IS_CORRECT_DOMAIN
until [[ $IS_CORRECT_DOMAIN != "Y" || $IS_CORRECT_DOMAIN != "N" ]]
do
echo -e "\e[33mIs domains settings correct setup in domain control panel? (Y/N): \e[39m"
read IS_CORRECT_DOMAIN
done
if [[ $SSL_INSTALL_ACTION == "Y" ]]
then
docker exec -it darbit_docker_webserver /bin/bash -c "certbot --nginx -d $SITE_NAME -d www.$SITE_NAME"
DOCKER_FOLDER_PATH=$WORK_PATH/bitrix_docker
mv $DOCKER_FOLDER_PATH/nginx/conf/conf.d/$SITE_NAME.conf $DOCKER_FOLDER_PATH/nginx/conf/conf.d/$SITE_NAME.conf.old && \
docker cp darbit_docker_webserver:/etc/nginx/conf.d/$SITE_NAME.conf $DOCKER_FOLDER_PATH/nginx/conf/conf.d/ && \
docker cp darbit_docker_webserver:/etc/letsencrypt/ $DOCKER_FOLDER_PATH/nginx/
fi
fi
echo -e "\n\e[33mConfiguring MySQL database \e[39m"
PROJECT_CLEARED_NAME=`echo $SITE_NAME | tr "." "_" | tr "-" "_"`
DATABASE_NAME=$PROJECT_CLEARED_NAME"_db"
DATABASE_USER=$PROJECT_CLEARED_NAME"_user"
DATABASE_PASSWORD=$(openssl rand -base64 32)
sleep 5
mysql --defaults-extra-file=$MYSQL_AUTH_FILE -P 3306 --protocol=tcp -e "CREATE DATABASE $DATABASE_NAME; CREATE USER '$DATABASE_USER'@'%' IDENTIFIED BY '$DATABASE_PASSWORD'; GRANT ALL PRIVILEGES ON $DATABASE_NAME.* TO '$DATABASE_USER'@'%'; FLUSH PRIVILEGES;"
echo -e "\e[33mDatabase server: db \e[39m"
echo -e "\e[33mDatabase name: "$DATABASE_NAME" \e[39m"
echo -e "\e[33mDatabase user: "$DATABASE_USER" \e[39m"
echo -e "\e[33mDatabase password: "$DATABASE_PASSWORD" \e[39m"
echo -e "\n\e[33mConfiguring FTP user \e[39m"
FTP_USER=$PROJECT_CLEARED_NAME"_ftp_"$((1 + $RANDOM % 999999))
FTP_PASSWORD=$(openssl rand -base64 32)
USER="ftpuser";
USER_ID=`cat /etc/passwd | grep "$USER:" | cut -d ':' -f 3`;
GROUP_ID=`cat /etc/passwd | grep "$USER:" | cut -d ':' -f 4`;
echo -e "${FTP_PASSWORD}\n${FTP_PASSWORD}\n" | pure-pw useradd ${FTP_USER} -u $USER_ID -g $GROUP_ID -D "$WEBSITE_FILES_PATH/" > /dev/null 2>&1;
pure-pw mkdb > /dev/null 2>&1;
systemctl restart pure-ftpd.service
echo -e "\e[33mURL: "$SITE_NAME" \e[39m"
echo -e "\e[33mFTP user: "$FTP_USER" \e[39m"
echo -e "\e[33mFTP password: "$FTP_PASSWORD" \e[39m"
else
echo -e "\e[31m By path $WEBSITE_FILES_PATH website exist. Please remove folder and restart installation script. \e[39m"
fi
elif [[ $ACTION == "F" ]]
then
#checking site name domain
echo -e "\n\n\e[33mEnter site name (websitename.domain | example: mail.ru): \e[39m"
read SITE_NAME
domainRegex="(^([a-zA-Z0-9](([a-zA-Z0-9-]){0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{0,10}$)"
until [[ $SITE_NAME =~ $domainRegex ]]
do
echo -e "\e[33mEnter site name (websitename.domain | example: mail.ru): \e[39m"
read SITE_NAME
done
WEBSITE_FILES_PATH=$WORK_PATH/bitrix/$SITE_NAME
#checking is site directory exist
if [ ! -d "$WEBSITE_FILES_PATH" ]
then
echo -e "\e[31m By path $WEBSITE_FILES_PATH website not exist. Please, restart script and enter correct website name [example: mail.ru]. \e[39m"
else
echo -e "\n\e[33mConfiguring FTP user \e[39m"
PROJECT_CLEARED_NAME=`echo $SITE_NAME | tr "." "_" | tr "-" "_"`
FTP_USER=$PROJECT_CLEARED_NAME"_ftp_"$((1 + $RANDOM % 999999))
FTP_PASSWORD=$(openssl rand -base64 32)
USER="ftpuser";
USER_ID=`cat /etc/passwd | grep "$USER:" | cut -d ':' -f 3`;
GROUP_ID=`cat /etc/passwd | grep "$USER:" | cut -d ':' -f 4`;
echo -e "${FTP_PASSWORD}\n${FTP_PASSWORD}\n" | pure-pw useradd ${FTP_USER} -u $USER_ID -g $GROUP_ID -D "$WEBSITE_FILES_PATH/" > /dev/null 2>&1;
pure-pw mkdb > /dev/null 2>&1;
systemctl restart pure-ftpd.service
echo -e "\e[33mURL: "$SITE_NAME" \e[39m"
echo -e "\e[33mFTP user: "$FTP_USER" \e[39m"
echo -e "\e[33mFTP password: "$FTP_PASSWORD" \e[39m"
fi
elif [[ $ACTION == "S" ]]
then
#checking site name domain
echo -e "\n\n\e[33mEnter site name (websitename.domain | example: mail.ru): \e[39m"
read SITE_NAME
domainRegex="(^([a-zA-Z0-9](([a-zA-Z0-9-]){0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{0,10}$)"
until [[ $SITE_NAME =~ $domainRegex ]]
do
echo -e "\e[33mEnter site name (websitename.domain | example: mail.ru): \e[39m"
read SITE_NAME
done
WEBSITE_FILES_PATH=$WORK_PATH/bitrix/$SITE_NAME
#checking is site directory exist
if [ ! -d "$WEBSITE_FILES_PATH" ]
then
echo -e "\e[31m By path $WEBSITE_FILES_PATH website not exist. Please, restart script and enter correct website name [example: mail.ru]. \e[39m"
else
#checking site installation type
echo -e "\e[33mDo you want install SSL from letsencrypt? (Y/N): \e[39m"
read SSL_INSTALL_ACTION
until [[ $SSL_INSTALL_ACTION != "Y" || $SSL_INSTALL_ACTION != "N" ]]
do
echo -e "\e[33mDo you want install SSL from letsencrypt? (Y/N): \e[39m"
read SSL_INSTALL_ACTION
done
if [[ $SSL_INSTALL_ACTION == "Y" ]]
then
echo -e "\n\e[33mPrepare to sending request to generate certificate for domains - $SITE_NAME, www.$SITE_NAME (Attention! Be sure that domain www.$SITE_NAME is correctly setup in domain control panel with A or CNAME dns record) \e[39m"
echo -e "\e[33mIs domains settings correct setup in domain control panel? (Y/N): \e[39m"
read IS_CORRECT_DOMAIN
until [[ $IS_CORRECT_DOMAIN != "Y" || $IS_CORRECT_DOMAIN != "N" ]]
do
echo -e "\e[33mIs domains settings correct setup in domain control panel? (Y/N): \e[39m"
read IS_CORRECT_DOMAIN
done
if [[ $SSL_INSTALL_ACTION == "Y" ]]
then
docker exec -it darbit_docker_webserver /bin/bash -c "certbot --nginx -d $SITE_NAME -d www.$SITE_NAME"
DOCKER_FOLDER_PATH=$WORK_PATH/bitrix_docker
mv $DOCKER_FOLDER_PATH/nginx/conf/conf.d/$SITE_NAME.conf $DOCKER_FOLDER_PATH/nginx/conf/conf.d/$SITE_NAME.conf.old && \
docker cp darbit_docker_webserver:/etc/nginx/conf.d/$SITE_NAME.conf $DOCKER_FOLDER_PATH/nginx/conf/conf.d/ && \
docker cp darbit_docker_webserver:/etc/letsencrypt/ $DOCKER_FOLDER_PATH/nginx/
fi
fi
fi
elif [[ $ACTION == "D" ]]
then
echo -e "\n\n\e[33mEnter FTP user to delete: \e[39m"
read FTP_USER
until [[ ! -z "$FTP_USER" ]]
do
echo -e "\n\n\e[33mEnter FTP user to delete: \e[39m"
read FTP_USER
done
CHECK_LOGIN=`cat "/etc/pure-ftpd/pureftpd.passwd" | grep "$FTP_USER:" | cut -d ':' -f 1 | wc -l`
if [[ $CHECK_LOGIN -eq 0 ]]
then
echo -e "\e[31m FTP user - $FTP_USER not found. Please, try again and enter correct FTP user name. \e[39m"
else
pure-pw userdel "${FTP_USER}" 2> /dev/null;
pure-pw mkdb > /dev/null 2>&1;
systemctl start pure-ftpd.service
echo -e "\e[32mFTP user deleted. \e[39m\n"
fi
elif [[ $ACTION == "R" ]]
then
#checking site name domain
echo -e "\n\n\e[33mEnter site name (websitename.domain | example: mail.ru): \e[39m"
read SITE_NAME
domainRegex="(^([a-zA-Z0-9](([a-zA-Z0-9-]){0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{0,10}$)"
until [[ $SITE_NAME =~ $domainRegex ]]
do
echo -e "\e[33mEnter site name (websitename.domain | example: mail.ru): \e[39m"
read SITE_NAME
done
WEBSITE_FILES_PATH=$WORK_PATH/bitrix/$SITE_NAME
#checking is site directory exist
if [ ! -d "$WEBSITE_FILES_PATH" ]
then
echo -e "\e[31m By path $WEBSITE_FILES_PATH website not exist. Please, restart script and enter correct website name [example: mail.ru]. \e[39m"
else
rm -rf $WEBSITE_FILES_PATH
echo -e "\e[32mWebsite folder removed \e[39m\n"
DOCKER_FOLDER_PATH=$WORK_PATH/bitrix_docker
docker exec -it darbit_docker_webserver /bin/bash -c "certbot delete --cert-name $SITE_NAME" && \
docker cp darbit_docker_webserver:/etc/letsencrypt/ $DOCKER_FOLDER_PATH/nginx/
rm -rf $DOCKER_FOLDER_PATH/nginx/conf/conf.d/$SITE_NAME.conf
cd $DOCKER_FOLDER_PATH && \
docker-compose stop web_server && \
docker-compose rm -f web_server && \
docker-compose build web_server && \
docker-compose up -d
echo -e "\e[32mWebsite nginx conf removed \e[39m\n"
PROJECT_CLEARED_NAME=`echo $SITE_NAME | tr "." "_" | tr "-" "_"`
DATABASE_NAME=$PROJECT_CLEARED_NAME"_db"
DATABASE_USER=$PROJECT_CLEARED_NAME"_user"
mysql --defaults-extra-file=$MYSQL_AUTH_FILE -P 3306 --protocol=tcp -e "DROP DATABASE $DATABASE_NAME; DROP USER '$DATABASE_USER'@'%';"
for FTP_USER in $(sed -n -e '/^'$PROJECT_CLEARED_NAME'_ftp_/p' /etc/pure-ftpd/pureftpd.passwd | cut -d ':' -f 1)
do
pure-pw userdel "${FTP_USER}" 2> /dev/null;
done
pure-pw mkdb > /dev/null 2>&1;
systemctl start pure-ftpd.service
echo -e "\e[32mWebsite database and user removed \e[39m\n"
fi
fi