[system] / trunk / xmlrpc / daemon / ww_daemon.pl Repository:
ViewVC logotype

View of /trunk/xmlrpc/daemon/ww_daemon.pl

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2989 - (download) (as text) (annotate)
Tue Nov 9 00:03:37 2004 UTC (15 years, 1 month ago) by gage
File size: 2258 byte(s)
Made changes which remove duplication between the code in Webwork.pm
and code in WW2.1  -- This should make it easier to maintain the webwork
daemons when changes are made in the core webwork code.

More changes are on the way so that the daemon can run behind apache.

    1 #!/usr/local/bin/perl -w
    2 
    3 # Copyright (C) 2001 Michael Gage
    4 
    5 ###############################################################################
    6 # The initial code simply initializes variables, defines addresses
    7 # for directories, defines some simple subroutines responders used in debugging
    8 # and makes sure that the appropriate CPAN library modules
    9 # are available.  The main code begins below that with the initialization
   10 # of the PGtranslator5 module.
   11 ###############################################################################
   12 
   13 BEGIN {
   14   require "WW.config" or die "Can't find configuration file WW.config in this directory"
   15 }
   16 
   17 use strict;
   18 use sigtrap;
   19 use Carp;
   20 
   21 my @SAVE_INC = @INC;
   22 
   23 use Webwork;
   24 use MathTranslators;
   25 use FetchLibraryProblems;
   26 use Frontier::Daemon_ww;
   27 
   28 $SIG{HUP} = \&Frontier::Daemon_ww::phoenix;
   29 
   30 
   31 sub restart {
   32       eval `cat ./Webwork.pm`;
   33       print "$@\n" if $@;
   34       eval `cat ./MathTranslators.pm`;
   35       print "$@\n" if $@;
   36 
   37       eval `cat ./FetchLibraryProblems.pm`;
   38       print "$@\n" if $@;
   39 
   40   print "some files re-read\n";
   41 }
   42 
   43 ###############################################################################
   44 # This sections starts up the WeBWorK daemon at http://webwork-db.math.rochester.edu:8005/
   45 ###############################################################################
   46 my $PORT = 8089;
   47 print "starting daemon on port $PORT\n";
   48 print "pid $$\n";
   49 `echo $$ >pid.txt`;
   50 new Frontier::Daemon_ww(
   51     LocalPort => $PORT,
   52     methods => {
   53   'echo'                    => \&Webwork::echo,
   54   'echo2'                   => \&Webwork::echo2,
   55   'renderProblem'       => \&Webwork::renderProblem,
   56   'readFile'          => \&FetchLibraryProblems::readFile,
   57   'listLib'                 => \&FetchLibraryProblems::listLib,
   58   'tex2pdf'         => \&MathTranslators::tex2pdf,
   59   'restart'         => \&restart,      #    \&Webwork::xmlquit,
   60   'quit'                    => \&Frontier::Daemon_ww::phoenix,
   61   'hello'                   =>  \&Webwork::hello
   62 
   63 });
   64 
   65 print "daemon stopped\n";
   66 
   67 ###############################################################################
   68 # The WeBWorK daemon would exit through here (if I could figure out how to
   69 # shut it down remotely. :-) )
   70 ###############################################################################
   71 
   72 

aubreyja at gmail dot com
ViewVC Help
Powered by ViewVC 1.0.9