CISC 474
Advanced Web Technologies
Spring 2005

TA: Emily Gibson

Office: 115B Pearson Hall
Hours: Mon  3:00 PM - 5:00 PM
E-mail: gibson@udel.edu

Quick Links

Announcements

  • Grading Rubrics

  • Web Hosting & Domain Names

    • godaddy.com
      Of course there are tons of hosting services on the web, but this is the cheapest I've found.

    • no-ip.com
      If you have your own web server, but you don't want to memorize your IP address or your ISP gives you a dynamic IP, you can give your computer a name for free!

  • Two Resins Running?

    For anyone having difficulty with 2 versions of resin running, add the following code to your wrapper.pl in the $RESIN_HOME/bin/ directory. If you've ever seen the error "Can't bind to port 8xxx" (where 8xxx is your port number) this is the same problem.

    Replace the following code in your wrapper.pl (over the old "stop" stuff) to get it to work right for both restart and stop...

    #
    # If desired, close the old server
    #
    if ($cmd eq "stop" || $cmd eq "restart") {
       if (-f "$pid_file") {
        $pid=`cat $pid_file`;
        chop($pid);
    
        if ($cmd eq "stop") {
            print("Stopping ${name}\n");
        }
        kill(15, $pid);
        while(`ps | grep $pid`){`sleep 5`;}
        unlink($pid_file);
        $date = `date`;
        chop($date);
    
        print("Resin stop at $date\n");
       }
       elsif ($cmd eq "stop") {
        print("No ${name} has been started\n");
       }
    }
    
    Note the original line, signaling for resin to stop:
        kill(15, $pid);
    causes the OS to send a mild kill signal (SIGTERM (15) vs. SIGKILL (9)) to the resin pid, and completes executing your script. Meaning, when you call $RESIN_HOME/bin/httpd.sh stop, that command will return before resin has actually stopped! This means it's possible to execute resin's start command before the old server has terminated. The new instance of resin can't start because the old version is still bound to your port. The
        while(`ps | grep $pid`){`sleep 5`;}
    command tells the script to wait until the resin pid has terminated, and then continue the script. This fix works for both the httpd.sh stop and restart commands.