October 06, 2008

configure tomcat web server on Windows XP

I extracted tomcat into some folder. When I tried to run tomcat and what do you know it were not working. Argh...After red some of text in the tomcat5 folder, these are what i should do to make tomcat works:

1. Set an environment variable named JAVA_HOME to the pathname of the directory into which you installed the jdk.

right click "My Computer" -> Properties -> Advanced -> Environment Variable -> New ->
a. set "Variable Name" with "JAVA_HOME"
b. set "Variable value" with "F:\Java\jdk1.5.0_10". This is depend where you installed jdk.

2. Open tomcat5\bin\catalina.bat. Set "CATALINA_HOME" with "F:\Java\tomcat5". This is depend where you extracted tomcat5.

3. To start tomcat run "F:\Java\tomcat5\bin\startup.bat". Open your browser and run "http://localhost:8080/".

That's it. Now my tomcat works.

Btw, if you want to stop tomcat run "F:\Java\tomcat5\bin\shutdown.bat"

put wget on the crontab

I've made email notication program using PHP. It works well if I run into browser, this is the url:

http://10.22.254.100/alert_email/msc.php

It also works well if I run using wget (one of unix command), this the unix command:

wget http://10.22.254.100/alert_email/msc.php

I need to schedule email notification, so its could send email automatically when I set the time. To do this kind of work, I use crontab. After, read some website on the internet. I do these:

1. create text file. I named it "stockcron". The content of the file is like this:

0 4 * * 1,2,3,4,5 wget http://10.22.254.100/alert_email/msc.php

2. Invoke the crontab command:

crontab stockcron

When the time come, my email notification program should send email automatically. But, don't know why Its didn't work. Argh...But don't worry guys n gals. I've got the solution. It took me few days to get the solution. Hold on thigh.....here's come the solution:

1. create file, I named it "email_cron_tes.sh". The content of the file is like this:

wget http://10.22.254.100/alert_email/msc.php

2. add this text on the crontab:

46 13 * * * /usr/bin/csh -c "(source /home/zul/.cshrc;/home/zul/email_cron_tes.sh)" > /dev/null 2>&1

The concept for this solution is the crontab will run your file "email_cron_tes.sh" in command prompt. Okeh...good luck guys n gals :)