Last active
July 6, 2018 21:51
-
-
Save antk25/04416d4c0588c8bcf09ed5225a9fa838 to your computer and use it in GitHub Desktop.
[Обновление modx на сервере] #server #modx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
echo "Enter username" | |
read USERNAME | |
############## | |
echo "Updating MODx" | |
cd /var/www/$USERNAME/www/ | |
echo "Getting file from modx.com..." | |
sudo -u $USERNAME wget -O modx.zip http://modx.com/download/latest/ | |
echo "Unzipping file..." | |
sudo -u $USERNAME unzip "./modx.zip" -d ./ > /dev/null | |
ZDIR=`ls -F | grep "modx-" | head -1` | |
if [ "${ZDIR}" = "/" ]; then | |
echo "Failed to find directory..."; exit | |
fi | |
if [ -d "${ZDIR}" ]; then | |
cd ${ZDIR} | |
echo "Moving out of temp dir..." | |
sudo -u $USERNAME cp -r ./* ../ | |
cd ../ | |
rm -r "./${ZDIR}" | |
echo "Removing zip file..." | |
rm "./modx.zip" | |
cd "setup" | |
echo "Running setup..." | |
sudo -u $USERNAME php ./index.php --installmode=upgrade --config=/var/www/$USERNAME/config.xml | |
echo "Done!" | |
else | |
echo "Failed to find directory: ${ZDIR}" | |
exit | |
fi | |
echo "Done" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment