2021-04-30 11:18:00 +00:00
|
|
|
#!/bin/bash
|
|
|
|
# This file for openresty template
|
|
|
|
# Give only one argument with new user name
|
|
|
|
# This replace name of home directory and rename /var/www/yoursite to new username
|
|
|
|
# Also it change root path in nginx config
|
|
|
|
NEW_USER=$1
|
|
|
|
|
2021-04-30 11:22:09 +00:00
|
|
|
usermod --login ${NEW_USER} --move-home --home="/home/${NEW_USER}" yoursite
|
2021-04-30 11:18:00 +00:00
|
|
|
|
|
|
|
mv /var/www/yoursite /var/www/${NEW_USER}
|
|
|
|
|
|
|
|
groupmod -n ${NEW_USER} yoursite
|
|
|
|
|
|
|
|
sed -i "s/yoursite/${NEW_USER}/" /opt/openresty/nginx/conf/conf.d/default.conf
|
|
|
|
|
|
|
|
systemctl reload openresty
|