Last active
April 23, 2023 14:22
-
-
Save gsdefender/509dccf1c944aab4fb95eea66a557648 to your computer and use it in GitHub Desktop.
Download and install latest Moodle
This file contains 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 | |
# replace with latest moodle directory and filename from moodle.org | |
DIRECTORY="stable401" | |
FILENAME="moodle-4.1.1.tgz" | |
URL="https://download.moodle.org/download.php/direct/$DIRECTORY/$FILENAME" | |
pushd | |
rm -f moodle-latest.tgz | |
wget "$URL" -O moodle-latest.tgz | |
if [ -f 'moodle-latest.tgz' ]; then | |
rm -rf /var/www/html/moodle.new | |
mkdir /var/www/html/moodle.new | |
tar xfz moodle-latest.tgz -C /var/www/html/moodle.new | |
rm -f moodle-latest.tgz | |
rm -rf /var/www/html/moodle.backup | |
mv /var/www/html/moodle /var/www/html/moodle.backup | |
mv /var/www/html/moodle.new/moodle /var/www/html/moodle | |
rmdir /var/www/html/moodle.new | |
cp /var/www/html/moodle.backup/config.php /var/www/html/moodle/config.php | |
chown -R apache:apache /var/www/html | |
chmod -R 755 /var/www/html/moodle | |
chmod 740 /var/www/html/moodle/admin/cli/cron.php | |
cd /var/www/html | |
restorecon -r . | |
fi | |
popd |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment