-
Notifications
You must be signed in to change notification settings - Fork 9
Installation
Download latest code from https://github.com/hit-moodle/onlinejudge/archives/master
Untar/unzip, rename dirname to onlinejudge and put it into <Installed Moodle Directory>/mod/assignment/type/
Linux only. Windows users skip to next step.
Prerequisite:
-
make
-
gcc, g++
-
libc-dev-i386, libstdc++-multilib (64 bit only)
In mod/assignment/type/onlinejudge/sandbox/, run:
$ make
The last line of make’s output must be All testcases are OK.
Users who want to use ideone.com should do this step. Windows users can use ideone.com only
Prerequisite: php with soap extension
-
register here: http://ideone.com/account/register
-
After activation, login and set API password here: http://ideone.com/account/
-
Open config.php and add the following lines:
$CFG->assignment_oj_ideone_username = 'change_me_to_ideone_username';
$CFG->assignment_oj_ideone_password = 'change_me_to_ideone_API_password';
-
Login moodle as admin
-
Follow the instructions
There are two recommended routines to make the judge work. The first is the most recommended but it works in Linux only.
(Linux only)
Setup moodle’s cron job to be called by php cli. In crontab, put a command which is similar with:
php -q /PATH/TO/MOODLE/admin/cron.php
That’s all! Read http://docs.moodle.org/en/Cron for detail about how to setup moodle cron job triggered by php cli (Not wget, curl and etc.).
If it works, a judge daemon would be created. Use
ps -FC php
to ensure the daemon is running.
If you can NOT trigger cron through php cli or are using Windows, then use this method.
Run the following command to create judge daemon:
sudo -u APACHE-USER php /PATH/TO/MOODLE/mod/assignment/type/onlinejudge/judged.php
The APACHE-USER means the username of apache in your system. It is www-data in debian, apache in fedora. Perhaps `ps aux|grep apache` or `ps aux|grep httpd` can help you getting the correct username.
Use
ps -FC php
to ensure the daemon is running.