Got Oodles of Moodles? PDF Print E-mail
User Rating: / 0
PoorBest 
Written by Ken Task   
Saturday, 07 August 2010 17:15
AddThis Social Bookmark Button
A way to force running of those cron jobs for each …

Directions for a CentOS/RHE layout where /var/www/html/ is web root
and /usr/local/bin/ is directory used for scripts and in environmental path of root user.


Create a text file (moodlesites.txt) that list the directories of the moodles.

As root user:
cd /var/www/html/ [ENTER]

ls -1 > moodlesites.txt [ENTER]

nano moodlesites.txt [ENTER]  remove lines that contain NON-moodle directories.
Save: [CTRL][X] Save [y]

mv moodlesites.txt /usr/local/bin/

cd /usr/local/bin/
nano runallcrons [ENTER]

copy and paste the following into the 'runallcrons' script:
---- begin below this line ----

#!/bin/bash
#
# echo $1;
for i in `cat moodles.txt`
do
echo "Site in que: $i";
echo 'Press ENTER to begin running cron.  Be PATIENT! Let it run!';
read $p;
php -f /var/www/moodlesites/$i/admin/cron.php;
echo 'Press ENTER for next Moodle Site.';
read $p;
done
echo 'Done!';


---- end clip above this line ---

Save the file: [CTRL][X] when prompted to save, Y.

chmod u+x runallcrons [ENTER]

Test your script.  From any location:  runallcrons

The script is interactive.  Requires you to press ENTER to continue to the next Moodle.  (those prompts can be removed from the script).  This pausing allows one to see the execution of each.

One reason to leave it interactive is to see errors on backups.
If running top in another terminal session one can monitor the usage also.
Last Updated on Sunday, 08 August 2010 03:53
 
 
Total Views: 329