Looks ok to me ... cept maybe 755 on code ...
My bash shell 'up' script in code - # lines are commented out ... ie, won't execute, but you could include them to do a backup of code, DB, and minimal moodledata just before updating the code.
I run cron just prior in hopes of stuff getting cleaned up a little.
Site in maintenance mode means users can't get in while updating.
And recently added the purge caches at the end ... the 'up' script is not world readable/writable and even though am sharing it's location and name here a browser cannot view it.
-rwx------. 1 root root 715 Sep 12 00:32 up
#echo '3.9.2 (Build: 20200914)'
#tar -cvf /home/backup/m39/moodle-code-392-$(date +%Y%m%d%-H%M%S).tar ../moodle39;
#tar -cvf /home/backup/m39/moodle-data-min-392-$(date +%Y%m%d%-H%M%S).tar /home/moodle39data/filedir;
#mysqldump -u root -p moodle39 > /home/backup/m39/moodle392-db-$(date +%Y%m%d%-H%M%S).sql;
#ls -l /home/backup/m39/;
# echo 'Paused ...';
# read $keypress;
git branch -a
php admin/cli/maintenance.php --enable;
php admin/cli/upgrade.php --non-interactive;
php admin/cli/maintenance.php --disable;
chown apache:apache * -R;
chown apache:apache /var/www/moodle39data/ -R;
chown root:root up bu;
fgrep '$release' version.php
I do edit the script replacing the first line as a reminder of what version.
Comment: git is the way to go when it comes to updating (Moodle releases new code fixes every week) and upgrading. By far better than using method which has too many moving parts!
Updates for me is a matter of minutes and far less prone to human error when performing.