Assignment 6 and 7. 

Let's talk assignment 6 first:

(a) if you need a new port number just ask

(b) complete instructions are at

  https://www.cs.indiana.edu/classes/c212-dgerman/spr2015/hwSix.html

(c) turn this in in person 

Examples of people who are done: 

Dimas is one of them, Tim is another. I am Andrew Denta. 

What steps do I need to take to get it done? 

(a) get the software and set up its environment

cp /l/www/classes/c212/software/grails-2.3.4.zip ~

It means copy /l/www/classes/c212/software/grails-2.3.4.zip into your home folder. 

(b) unpack the archive

unzip grails-2.3.4.zip 

This extracts all files and puts them in a new folder, grails-2.3.4

(c) move into that folder

cd grails-2.3.4

This takes me there and I can see it with pwd.

(d) next I set up the environment variables. 

For Tomcat we had CATALINA_HOME, CLASSPATH, JAVA_HOME. 

For Grails we need JAVA_HOME and also GRAILS_HOME, and PATH. 

For Tomcat we placed those in ~/.bash_profile

This is why Tomcat's environment is set automatically when we log in. 

For Grails we need to source by hand. 

(e) Next I need to download and unzip all the code from the book. 

  370  cp /l/www/classes/c212/software/graina2-master.zip ~
  375  cd ~
  383  unzip graina2-master.zip
  388  cd graina2-master
  390  cd ch01
  393  cd qotd/

(f) Now start the server in this folder:

-- first I find a port that's available (15732 for adenta)

-- then I start server on that port number

-bash-4.1$ netstat -a | grep 15732
unix  3      [ ]         STREAM     CONNECTED     3418515732
-bash-4.1$ pwd
/u/adenta/graina2-master/ch01/qotd
-bash-4.1$

-- to start the server I do: 

   grails -Dserver.port=15732 run-app

(g) I then stop the server (^C) and start it in the background 

 ( nohup grails run-app -Dserver.port=14694 --non-interactive 2>&1 > /dev/null & )

And now it runs in the background. 

I can log out. 

--

-bash-4.1$ pwd
/u/adenta/graina2-master/ch01/qotd
-bash-4.1$ cat /u/adenta/apache-tomcat-7.0.35/webapps/ROOT/index.html
<head>
<link href='http://fonts.googleapis.com/css?family=Roboto+Slab' rel='stylesheet' type='text/css'>
<style>
body    {
background-color:#C88141;
}
h1 {
    text-align: center;
}
#wrap   {
margin-left: auto;
margin-right: auto;
width: 60%;
padding:20px;
background-color:#FFEBCD;
border-bottom-style:solid;
border-width:0px;
border-radius: 15px;
font-family: 'Roboto Slab', serif;
width:auto;
}

pre     {
font-family: 'Roboto Slab', serif;
}</style>
<head>

<div id="wrap">
<h1> Andrew Denta </h1>
<p> This is my Server Index </p>


<p> Link to my Grails Development Server: <a href="http://silo.cs.indiana.edu:15732/qotd/quote/random">here</a>. </p>

</div>
-bash-4.1$ history
    1  cp /l/www/classes/a348/spr2013/software/apache-tomcat-7.0.35.tar.gz .
    2  ls
    3  pwd
    4  gunzip apache-tomcat-7.0.35.tar.gz
    5  ls
    6  tar xf apache-tomcat-7.0.35.tar
    7  ls
    8  ls -l
    9  cd apa
   10  cd apache-tomcat-7.0.35
   11  ls
   12  pwed
   13  pwd
   14  cd conf
   15  mv server.xml server-distr.xml
   16  cat server.xml
   17  ls
   18  pico -w server.xml
   19  ls
   20  touch server.xml
   21  ls
   22  cat server.xml
   23  ls
   24  pico server.xml
   25  rm server.xml
   26  ls
   27  pico server-distr.xml
   28  ls -l
   29  cd apache-tomcat-7.0.35
   30  ls
   31  cd conf
   32  ls
   33  pico -w server.xml
   34  pwd
   35  pico -w ~/.bash_rofile
   36  pico -w ~/.bash_profile
   37  pwd
   38  pico -w ~/.bash_profile
   39  cd
   40  ls
   41  cd apache-tomcat-7.0.35
   42  ls
   43  cd lib
   44  cd
   45  cd apache-tomcat-7.0.35/conf
   46  ls
   47  pico -w server.xml
   48  pico -w ~/.bash_profile
   49  emacs ~/.bash_profile
   50  $CATALINA_HOME/bin/startup.sh
   51  emacs ~/.bash_profile
   52  $CATALINA_HOME/bin/startup.sh
   53  pico -w ~/.bash_profile
   54  echo $CATALINA_HOME
   55  pico -w ~/.bash_profile
   56  echo $JAVA_HOME
   57  source ~/.bash_profile
   58  echo $JAVA_HOME
   59  pwd
   60  $CATALINA_HOME/bin/startup.sh
   61  cd ..
   62  ls
   63  cd webaps/
   64  cd ROOT/
   65  cd webapps/
   66  cd ROOT/
   67  pico -w index.html
   68  pwd
   69  cd
   70  pwd
   71  echo $CATALINA_HME
   72  echo $CATALINA_HOME
   73  mkdir $CATALINA_HOME/webaps/iceblox
   74  mkdir $CATALINA_HOME/webapps/iceblox
   75  mkdir $CATALINA_HOME/webapps/iceblox/WEB-INF/classes
   76  mkdir $CATALINA_HOME/webapps/iceblox/WEB-INF
   77  mkdir $CATALINA_HOME/webapps/iceblox/WEB-INF/lib
   78  cp /l/www/classes/c212/fall2010/notes/iceblox/Iceblox.java $CATALINA_HOME/webapps/iceblox
   79   cp /l/www/classes/c212/fall2010/notes/iceblox/iceblox.gif  $CATALINA_HOME/webapps/iceblox
   80  cp /l/www/classes/c212/fall2010/notes/iceblox/iceblox.html $CATALINA_HOME/webapps/iceblox
   81  cd $CATALINA_HOME
   82  apachectl wd
   83  pwd
   84  cd webapps/
   85  ls
   86  ls -l
   87  du -a iceblox/
   88  cd iceblox.
   89  ls
   90  cd iceblox
   91  ls
   92  javac Iceblox.java
   93  mkdir $CATALINA_HOME/webapps/chat
   94  mkdir $CATALINA_HOME/webapps/chat/WEB-INF
   95  mkdir $CATALINA_HOME/webapps/chat/WEB-INF/classes
   96  mkdir $CATALINA_HOME/webapps/chat/WEB-INF/lib
   97  cp /l/www/classes/c212/fall2012/chat/Chat.java        $CATALINA_HOME/webapps/chat/WEB-INF/classes
   98  cp /l/www/classes/c212/fall2012/chat/ChatServlet.java $CATALINA_HOME/webapps/chat/WEB-INF/classes
   99  cp /l/www/classes/c212/fall2012/chat/web.xml          $CATALINA_HOME/webapps/chat/WEB-INFcp /l/www/classes/c212/fall2012/chat/ChatApplet.java  $CATALINA_HOME/webapps/chat
  100  cp /l/www/classes/c212/fall2012/chat/ChatApplet.java  $CATALINA_HOME/webapps/chat
  101  cp /l/www/classes/c212/fall2012/chat/HttpMessage.java $CATALINA_HOME/webapps/chat
  102  cp /l/www/classes/c212/fall2012/chat/web.xml          $CATALINA_HOME/webapps/chat/WEB-INF
  103  cd $CATALINA_HOME/webapps/chat
  104  pico -w ChatApplet.java
  105  cd ~/WEB_INF/classes
  106  ls
  107  pwd
  108  cd WEB-INF
  109  pico -w Chat.java
  110  cd classes
  111  pico -w Chat.java
  112  javac Chat.java
  113  cd webapps/chat
  114  cd
  115  ls
  116  cd apache-tomcat-7.0.35
  117  cd webapps/chat/
  118  ls
  119  javac ChatAplet.java
  120  javac HttpMessage.java
  121  ls
  122  javac ChatApplet.java
  123  ls
  124  cd WEB-INF
  125  ls
  126  cd classes
  127  ls
  128  javac ChatServlet.java
  129  ls
  130  ls -l
  131  pico -w Chat.java
  132  javac *.java
  133  ls l
  134  ls -l
  135  cd $CATALINA_HOME/webapps/chat
  136  pico -w ChatApplet.java
  137  javac *.java
  138  cd WEB-INF/classes/
  139  pico -w Chat.java
  140  javac *.java
  141  pico -w Chat.java
  142  javac *.java
  143  cd
  144  cd apache-tomcat-7.0.35/webApps/chat
  145  cd apache-tomcat-7.0.35/webApps/
  146  cd apache-tomcat-7.0.35/
  147  ls
  148  cd webapps
  149  ls
  150  cd chat
  151  ls
  152  pico -w HttpMessage.java
  153  pico -w ChatApplet.java
  154  javac *.java
  155  ls
  156  cd apache-tomcat-7.0.35
  157  ls
  158  cd bin
  159  ls
  160  shutdown.sh
  161  $CATALINA_HOME/bin/shutdown.sh
  162  cd
  163  ls
  164  cd apache-tomcat-7.0.35
  165  ls
  166  cd webapps/
  167  ls
  168  cd chat
  169  ls
  170  javac *.java
  171  cd
  172  cd apache-tomcat-7.0.35/webapps/chat/
  173  ls
  174  cd WEB-INF/
  175  javac *.java
  176  javac -r *.java
  177  cd classes/
  178  javac *.java
  179  $CATALINA_HOME/bin/startup.sh
  180  cd classes/
  181  cd
  182  cd apache-tomcat-7.0.35/webapps/chat/
  183  ls
  184  ls -l
  185  cd WEB-INF/
  186  ls
  187  cd classes/
  188  ls
  189  ls -l
  190  cd classes/
  191  ls
  192  cd apache-tomcat-7.0.35/webapps/chat/
  193  ls
  194  ls -l
  195  pwd
  196  cd
  197  cd apache-tomcat-7.0.35/webapps/chat
  198  ls
  199  javac *.java
  200  ls -l
  201  ls
  202  javac *.java
  203  cd WEB-INF/classes/
  204  javac *.java
  205  $CATALINA_HOME/bin/shutdown.sh
  206  $CATALINA_HOME/bin/startup.sh
  207  cd apache-tomcat-7.0.35
  208  ls
  209  cd lls
  210  cd apache-tomcat-7.0.35/webapps/
  211  ls
  212  cd
  213  cd apache-tomcat-7.0.35
  214  ls
  215  cd conf
  216  ls
  217  pico -w server.xml
  218  ps
  219  bash
  220  sudo
  221  color 33
  222  logs
  223  ls
  224  cd $CATALINA_HOME
  225  cd webapps/
  226  cd chat/
  227  pico -w ChatApplet.java
  228  cd WEB-INF/
  229  cd classes/
  230  pico -w Chat.java
  231  javac *.java
  232  /u/adenta/apache-tomcat-7.0.35/bin/shutdown.sh
  233  ps -ef | grep dent
  234  clear
  235  /u/adenta/apache-tomcat-7.0.35/bin/startup.sh
  236  /u/adenta/apache-tomcat-7.0.35/bin/shutdown.sh
  237  pwd
  238  cd ../..
  239  pico -w ChatApplet.java
  240  netstat -a | grep 13761
  241  pico -w ChatApplet.java
  242  javac *.java
  243  /u/adenta/apache-tomcat-7.0.35/bin/startup.sh
  244  pico -w ChatApplet.java
  245  cd WEB-INF/
  246  cd classes/
  247  pico -w Chat.java
  248  javac *.java
  249  /u/adenta/apache-tomcat-7.0.35/bin/shutdown.sh
  250  ps -ef | grep dent
  251  /u/adenta/apache-tomcat-7.0.35/bin/startup.sh
  252  pwd
  253  cd ..
  254  pico -w ChatApplet.java
  255  grep -i cs *.java
  256  cd WEB-INF/
  257  cd classes/
  258  grep -i cs *.java
  259  pico -w Chat.
  260  pico -w Chat.java
  261  pwd
  262  cd ..
  263  pico -w ChatApplet.
  264  pico -w ChatApplet.java
  265  javac *.java
  266  cd WEB-INF/
  267  cd classes/
  268  javac *.java
  269  /u/adenta/apache-tomcat-7.0.35/bin/shutdown.sh
  270  /u/adenta/apache-tomcat-7.0.35/bin/startup.sh
  271  exit
  272  ps -ef | grep dent
  273  pwd
  274  cd $CATALINA_HOME
  275  ls
  276  cd conf
  277  ls
  278  cat server.xml
  279  cd ../logs/
  280  clear
  281  ls -l
  282  more *
  283  clear
  284  ls -l
  285  pwd
  286  rm *
  287  /u/adenta/apache-tomcat-7.0.35/bin/shutdown.sh
  288  clear
  289  ls -l
  290  cd $CATALINA_HOME
  291  cd webapps/
  292  cd chat/
  293  lsd
  294  ls -l
  295  cd WEB-INF/
  296  cd classes/
  297  ls -l
  298  pico -w Chat.java
  299  rm *.class
  300  ls -l
  301  grep 13769 Chat.java
  302  man grep
  303  javac *.java
  304  cd ../..
  305  pwd
  306  ls -l
  307  rm *.class
  308  ls -l
  309  pico -w ChatApplet.java
  310  grep 13769 Chat.java
  311  grep 13769 *.java
  312  grep -n 13769 *.java
  313  javac *.java
  314  clear
  315  cd $CATALINA_HOME
  316  cd logs
  317  ls -l
  318  /u/adenta/apache-tomcat-7.0.35/bin/startup.sh
  319  ls -l
  320  more *
  321  pwd
  322  exit
  323  clear
  324  pwd
  325  ls -l
  326  quota -v
  327  clear
  328  pwd
  329  clear
  330  powd
  331  clear
  332  pwd
  333  ls -l
  334  cp /l/www/classes/c212/software/grails-2.3.4.zip ~
  335  ls -l
  336  clear
  337  whoami
  338  ls -ld grails-2.3.4.zip
  339  man unzip
  340  unzip grails-2.3.4.zip
  341  clear
  342  pwd
  343  ls -ld grails*
  344  cd grails-2.3.4
  345  pwd
  346  ls -l
  347  ls
  348  clear
  349  ls -l
  350  pico -w .grails-setup
  351  echo $GRAILS_HOME
  352  source .grails-setup
  353  echo $GRAILS_HOME
  354  clear
  355  echo $CATALINA_HOME
  356  ls
  357  ls -l
  358  ls -ld .grails-setup
  359  pico -w .grails-setup
  360  whoamu
  361  whoami
  362  clear
  363  pico -w .grails-setup
  364  source .grails-setup
  365  echo $GRAILS_HOME
  366  which grails
  367  echo $PATH
  368  clear
  369  pwd
  370  cp /l/www/classes/c212/software/graina2-master.zip ~
  371  ls
  372  ls -l
  373  ls -ld ../graina2-master.zip
  374  clear
  375  cd ~
  376  pwd
  377  ls
  378  ls -l
  379  clear
  380  ls -ld
  381  clear
  382  ls -l
  383  unzip graina2-master.zip
  384  clear
  385  ls
  386  clear
  387  ls -l
  388  cd graina2-master
  389  ls -l
  390  cd ch01
  391  clear
  392  ls -l
  393  cd qotd/
  394  ls -l
  395  history
  396  clear
  397  pwd
  398  netstat -a | grep 33333
  399  netstat -a | grep 44444
  400  netstat -a | grep 55555
  401  clear
  402  netstat -a | grep 15732
  403  netstat -a | grep 8346
  404  grails -Dserver.port=15732 run-app
  405  clear
  406  pwd
  407  pico -w /u/adenta/apache-tomcat-7.0.35/webapps/ROOT/index.html
  408  ps -ef | grep adenta
  409  netstat -a | grep 15732
  410  pwd
  411   ( nohup grails run-app -Dserver.port=15732 --non-interactive 2>&1 > /dev/null & )
  412  clear
  413  pwd
  414  cat /u/adenta/apache-tomcat-7.0.35/webapps/ROOT/index.html
  415  history
-bash-4.1$