Linux Ubuntu 10.04 Tomcat6
--------------------------

This piece of text describes a sequence of manual 'hacking' to get tomcat alive.
When you install tomcat and java using ubuntu-linux 10.04 apt or synaptic package management tools.

Document date: 11 may 2010


-First read some documentation on tomcat 6:
 http://tomcat.apache.org/tomcat-6.0-doc/introduction.html

-Install jre/jdk using synaptic  (package: openjdk-6-jdk)

I prefer to download the tomcat class files and install it manually

-Install tomcat using synaptic   (package: tomcat6) 
 defaults to using:
   CATALINA_BASE: /var/lib/tomcat6
   CATALINA_HOME: /usr/share/tomcat6
   CATALINA_TMPDIR: /tmp/tomcat6-tmp
   JRE_HOME: /usr/lib/jvm/java-6-openjdk
   CLASSPATH: /usr/share/tomcat6/bin/bootstrap.jar
 also creates a user: 'tomcat6' group: 'tomcat6'
  


-Now decide to manually hack directories and symlinks to get tomcat6 running
 or use the helper script '/usr/bin/tomcat6-instance-create'

-Please read the manual for this:
 man tomcat6-instance-create

-Use the helper script:
-Create a tomcat in your home directory listing on http-port 8880 and shutting down via port 8805:
 /usr/bin/tomcat6-instance-create  -p 8880 -c 8805 /home/pim/tomcat


todo---
-Do not use the helper-script and start hacking:
-Open a bash shell by starting a terminal window

-Become root in that bash shell: 
 sudo bash

as user pim
-edit ~/.bashrc

mods
export CLASSPATH=/usr/share/tomcat/lib/jsp-api.jar:/usr/share/tomcat/lib/servlet-api.jar
export JAVA_HOME=/usr/lib/jvm/java-6-sun-1.6.0.20
export PATH=$PATH:/usr/lib/jvm/java-6-sun-1.6.0.2

alias vi='vim'
alias vit='vim -t'

-Create a symbolic link '/usr/share/tomcat' to '/usr/share/tomcat6' 
 ln -s /usr/share/tomcat6 /usr/share/tomcat

-Decide if the 'ave-webapp' is to be run from the 'default' ROOT webapp directory
 (the default context) 
  or
 as a seperate webapp.

 We decide to run it as the 'default-webapp' from the ROOT directory.

-Create a ROOT directory in the tomcat' webapps directory
 mkdir /usr/share/tomcat/webapps/ROOT

-Create a META-INF directory in the tomcat' webapps/ROOT directory
 mkdir /usr/share/tomcat/webapps/ROOT/META-INF

-Create a WEB-INF directory in the ROOT/ directory
 mkdir usr/share/tomcat/webapps/ROOT/WEB-INF

-Create a classes directory in the ROOT/WEB-INF directory
 mkdir usr/share/tomcat/webapps/ROOT/WEB-INF/classes

-Copy the 'ave' index.jsp  into ROOT directory
 cp /home/pim/smitt/src/jsp/index.jsp /usr/share/tomcat/webapps/ROOT/
 
-Create a conf directory
 mkdir /usr/share/tomcat/conf

-Copy all files from /usr/share/tomcat/skel/* into the conf directory
 cp /usr/share/tomcat/skel/conf/* /usr/share/tomcat6/conf/

-Check if Tomcat' is configured to run on port 8080
 vi /usr/share/tomcat/conf/server.xml
 look for port 8080 default http port

-Create a log directory /usr/share/tomcat/logs
 mkdir /usr/share/tomcat/logs

-Start tomcat: 
 /usr/share/tomcat6/bin/startup.sh

-Check if tomcat is running: 
 ps -ef

-Look in the log file for startup errors:
 less /usr/share/tomcat6/logs/catalina.out

-put your webbrowser to:
 http://localhost:8080/default_root/index.html
 a page wil show up: 'It works ! If you're seeing this page ...'

-Stop tomcat:
 /usr/share/tomcat6/bin/shutdown.sh
 
 


optional
-Set up an environment variable $TOMCAT_HOME
 export TOMCAT_HOME=/usr/share/tomcat
 


Linux Ubuntu 10.04 Ant
----------------------

-Install ant using synaptic


Linux Ubunt 10.04 ctags
-----------------------

-Install ctags using the package manager

$sudo apt-get install exuberant-ctags
     

Linux Ubuntu 10.04 Wakeonlan
----------------------

ACTIONS to do on the 'sleeping computer':

(please read: http://www.mythtv.org/wiki/Wake-on-LAN )

-Enable in the BIOS 'wake-on-lan' ( or 'wake-on-pci-devices')
 Mostly the BIOS is entered when holding the DEL key during boot up of the computer, 
 and look for a setting (mostly in the 'power' section)

-Figger out the hardware address (also called mac-address) of the network-interface card you want to use for 'wake-on-lan'
$ ifconfig

eth0      Link encap:Ethernet  HWaddr 22:33:44:55:66:77  
          inet addr:10.0.0.2  Bcast:10.0.0.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:148 errors:0 dropped:0 overruns:0 frame:0
          TX packets:117 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:185357 (185.3 KB)  TX bytes:8875 (8.8 KB)
          Interrupt:23 Base address:0xc000 

lo        Link encap:Local Loopback  
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:24 errors:0 dropped:0 overruns:0 frame:0
          TX packets:24 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:1508 (1.5 KB)  TX bytes:1508 (1.5 KB)

or
$ arp -v host-ip-address
$ arp -v 10.0.0.12

Address                  HWtype  HWaddress           Flags Mask            Iface
asus2                    ether   22:33:44:55:66:77   C                     eth0
Entries: 2	Skipped: 1	Found: 1


As you can see the network interface 'eth0' has a hardware address: 22:33:44:55:66:77

We use are going to use the interface eth0 to wake up the computer. 

-Check whether you have the command 'ethtool' installed or else install it using the package-manager

-Find out whether ther network interface car supports Wake-on-lan.

 $ sudo ethtool eth0

  Settings for eth0:
	Supported ports: [ MII ]
	Supported link modes:   10baseT/Half 10baseT/Full 
	                        100baseT/Half 100baseT/Full 
	                        1000baseT/Full 
	Supports auto-negotiation: Yes
	Advertised link modes:  10baseT/Half 10baseT/Full 
	                        100baseT/Half 100baseT/Full 
	                        1000baseT/Full 
	Advertised pause frame use: No
	Advertised auto-negotiation: Yes
	Link partner advertised link modes:  Not reported
	Link partner advertised pause frame use: No
	Link partner advertised auto-negotiation: No
	Speed: 1000Mb/s
	Duplex: Full
	Port: MII
	PHYAD: 9
	Transceiver: external
	Auto-negotiation: on
	Supports Wake-on: g
	Wake-on: d
	Link detected: yes

 It says: 'Supports Wake-on: g'  which means that it supports waking up  after receiving the magic packet

-Now tell the interface card to react on a 'wake-on-lan' magic packet received on the network
 
 $ sudo ethtool -s eth0 wol g

-Query the network card settings again:

 $ sudo ethtool eth0

  Settings for eth0:
	Supported ports: [ MII ]
	Supported link modes:   10baseT/Half 10baseT/Full 
	                        100baseT/Half 100baseT/Full 
	                        1000baseT/Full 
	Supports auto-negotiation: Yes
	Advertised link modes:  10baseT/Half 10baseT/Full 
	                        100baseT/Half 100baseT/Full 
	                        1000baseT/Full 
	Advertised pause frame use: No
	Advertised auto-negotiation: Yes
	Link partner advertised link modes:  Not reported
	Link partner advertised pause frame use: No
	Link partner advertised auto-negotiation: No
	Speed: 1000Mb/s
	Duplex: Full
	Port: MII
	PHYAD: 9
	Transceiver: external
	Auto-negotiation: on
	Supports Wake-on: g
	Wake-on: g
	Link detected: yes

 It now says: 'Wake-on: g'  which means that is enabled for a wake-up call.

-Take care that just before a shutdown and just after a reboot, the network-card is set into the correct state
 by running this command: 'sudo ethtool -s eth0 wol g'

 We should put this in a bash script, like: 'wol.sh' having two lines in it

 #!/bin/bash
 ethtool -s eth0 wol g


-Set the script to be executable
 
 $ sudo chmod +x wol.sh

-Test the script

 $ sudo ./wol.sh

When it does not complain, we asume it works.

-Place this script in a correct initialisation directory
 We use the directory /etc/init.d/

-Go to that directory

$ cd /etc/init.d

-Now move the file

$ sudo mv ~/wol.sh .

-make 'root' the owner

$ sudo chown root:root wol.sh

-That then looks like: 
 $ ls -l wol.sh

 -rwxr-xr-x 1 root root 34 2010-05-18 21:05 wol.sh

-Now add this file to all runlevels, when the computer shuts down or starts up.

 (please read: http://embraceubuntu.com/2005/09/07/adding-a-startup-script-to-be-run-at-bootup/ )

 Use the debian utility 'update-rc.d' to create the correct start/shutdown files in the correct rc.d directories.
 Check if you have it installed, else install using the package-manager.

 Running the following command will create 

 $ sudo update-rc.d wol.sh defaults

 The option 'defaults' will create links to stop wol.sh when shutting down 
 The option 'defaults' will create links to stop wol.sh when starting up

 like:
lrwxrwxrwx 1 root root 16 2010-05-18 21:15 rc0.d/K20wol.sh -> ../init.d/wol.sh
lrwxrwxrwx 1 root root 16 2010-05-18 21:15 rc1.d/K20wol.sh -> ../init.d/wol.sh
lrwxrwxrwx 1 root root 16 2010-05-18 21:15 rc2.d/S20wol.sh -> ../init.d/wol.sh
lrwxrwxrwx 1 root root 16 2010-05-18 21:15 rc3.d/S20wol.sh -> ../init.d/wol.sh
lrwxrwxrwx 1 root root 16 2010-05-18 21:15 rc4.d/S20wol.sh -> ../init.d/wol.sh
lrwxrwxrwx 1 root root 16 2010-05-18 21:15 rc5.d/S20wol.sh -> ../init.d/wol.sh
lrwxrwxrwx 1 root root 16 2010-05-18 21:15 rc6.d/K20wol.sh -> ../init.d/wol.sh
 

-Now switch to another computer which you use to wake up the previous one.


-ACTIONS to do on the 'awake computer':

-check whether you have the command 'wakeonlan' installed, else install it using the package manager.

-try it:
 
 $ wakeonlan -i 10.0.0.255 22:33:44:55:66:77
Sending magic packet to 10.0.0.255:9 with 22:33:44:55:66:77

 the 10.0.0.255 is the broadcast address of the network 
 the 22:33:44:55:66:77 is the hardware address of the network nterface car of the computer to wake up.

-Now switch back to the sleeping computer, and shut it down

$ sudo halt
Broadcast message from pim@asus2
	(/dev/pts/0) at 21:57 ...

The system is going down for halt NOW!

-Your 'logged-out', and back on the 'awake computer',  the sleeping computer has shut-down and is now sleeping

-Try to wake-it-up again, from your 'awake' computer

$ wakeonlan -i 10.0.0.255 22:33:44:55:66:77
Sending magic packet to 10.0.0.255:9 with 22:33:44:55:66:77

-Ping it to see it it 'awakes'.

$ ping 10.0.0.12
PING 10.0.0.12 (10.0.0.12) 56(84) bytes of data.
From 10.0.0.2 icmp_seq=10 Destination Host Unreachable
From 10.0.0.2 icmp_seq=11 Destination Host Unreachable
From 10.0.0.2 icmp_seq=12 Destination Host Unreachable
...
64 bytes from 10.0.0.12: icmp_seq=43 ttl=64 time=1003 ms
64 bytes from 10.0.0.12: icmp_seq=44 ttl=64 time=0.082 ms
64 bytes from 10.0.0.12: icmp_seq=45 ttl=64 time=0.318 ms
64 bytes from 10.0.0.12: icmp_seq=46 ttl=64 time=0.116 ms

-When you receive bytes from the 'sleeping' computer, it did wake-up after a magic packet

-Now place your wakeonlan command in a bash script, like: 'wakeonasus2' having two lines in it

#!/bin/bash
# wakes up asus2 via eth0
wakeonlan -i 10.0.0.255 22:33:44:55:66:77


-Set the script to be executable
 
 $ sudo chmod +x wakeonasus2

-Test the script

 $ ./wakeonasus2

When it does not complain, we asume it works.

-create a bin directoy in your home directory

$ mkdir bin

-go to that directory

$ cd bin

-move the script in the bin directory

$ mv ../wakeonasus2 .

-edit/update your PATH environment variable to have your bin directory in it
-put it to the end of the path-sequence

$ vi ~/.bashrc

PATH=$PATH:/$HOME/bin
export PATH

-update your current shell to have the new path setting

$ source ~/.bashrc

-test your path setting

$ echo $PATH
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/lib/jvm/java-6-openjdk/bin:/home/pim/bin

-your home-bin directory should be the last in the sequence



Linux Ubuntu 10.04 IVTV driver etc.
----------------------

-Read 'http://ivtvdriver.org/index.php/Howto' for more details
-Read 'http://ivtvdriver.org/index.php/Troubleshooting' for more details

-dmesg > temp

look for:

[    3.442972] ivtv 0000:05:06.0: PCI INT A -> Link[APC1] -> GSI 16 (level, low) -> IRQ 16
[    3.442980] ivtv0: Unreasonably low latency timer, setting to 64 (was 32)
[    3.462530] gameport: NS558 PnP Gameport is pnp00:0d/gameport0, io 0x201, speed 59659kHz
[    3.503323] tveeprom 2-0050: Hauppauge model 26559, rev F089, serial# 10663193
[    3.503327] tveeprom 2-0050: tuner model is TCL MFPE05 2 (idx 89, type 38)
[    3.503330] tveeprom 2-0050: TV standards PAL(B/G) PAL(I) SECAM(L/L') PAL(D/D1/K) (eeprom 0x74)
[    3.503334] tveeprom 2-0050: audio processor is CX25843 (idx 37)
[    3.503336] tveeprom 2-0050: decoder processor is CX25843 (idx 30)
[    3.503339] tveeprom 2-0050: has radio
[    3.503341] ivtv0: Autodetected Hauppauge WinTV PVR-150
[    3.547628] ACPI: PCI Interrupt Link [APC3] enabled at IRQ 18
[    3.547635]   alloc irq_desc for 18 on node -1
[    3.547638]   alloc kstat_irqs on node -1
[    3.547647] nouveau 0000:01:00.0: PCI INT A -> Link[APC3] -> GSI 18 (level, low) -> IRQ 18
[    3.547652] nouveau 0000:01:00.0: setting latency timer to 64
[    3.554692] [drm] nouveau 0000:01:00.0: Detected an NV40 generation card (0x044100a2)
[    3.555346] [drm] nouveau 0000:01:00.0: Attempting to load BIOS image from PROM
[    3.706990] cx25840 2-0044: cx25843-24 found @ 0x88 (ivtv i2c driver #0)
[    3.721653] ACPI: PCI Interrupt Link [APCJ] enabled at IRQ 22
[    3.721660] Intel ICH 0000:00:04.0: PCI INT A -> Link[APCJ] -> GSI 22 (level, low) -> IRQ 22
[    3.721693] Intel ICH 0000:00:04.0: setting latency timer to 64
[    3.742075] tuner 2-0043: chip found @ 0x86 (ivtv i2c driver #0)
[    3.750316] tda9887 2-0043: creating new instance
[    3.750320] tda9887 2-0043: tda988[5/6/7] found
[    3.752931] tuner 2-0061: chip found @ 0xc2 (ivtv i2c driver #0)
[    3.756294] wm8775 2-001b: chip found @ 0x36 (ivtv i2c driver #0)
[    3.758329] [drm] nouveau 0000:01:00.0: ... appears to be valid
[    3.758334] [drm] nouveau 0000:01:00.0: BIT BIOS found
[    3.758338] [drm] nouveau 0000:01:00.0: Bios version 05.44.02.32
[    3.758342] [drm] nouveau 0000:01:00.0: BIT table 'd' not found
[    3.758346] [drm] nouveau 0000:01:00.0: Found Display Configuration Block version 3.0
[    3.758350] [drm] nouveau 0000:01:00.0: DCB connector table: VHER 0x30 5 7 2
[    3.758354] [drm] nouveau 0000:01:00.0:   0: 0x00000000: type 0x00 idx 0 tag 0xff
[    3.758358] [drm] nouveau 0000:01:00.0:   1: 0x00002130: type 0x30 idx 1 tag 0x08
[    3.758361] [drm] nouveau 0000:01:00.0:   2: 0x00000210: type 0x10 idx 2 tag 0xff
[    3.758365] [drm] nouveau 0000:01:00.0:   3: 0x00000211: type 0x11 idx 2 tag 0xff
[    3.758368] [drm] nouveau 0000:01:00.0:   4: 0x00000213: type 0x13 idx 2 tag 0xff
[    3.758372] [drm] nouveau 0000:01:00.0: Raw DCB entry 0: 01000300 00000028
[    3.758376] [drm] nouveau 0000:01:00.0: Raw DCB entry 1: 02011310 00000028
[    3.758379] [drm] nouveau 0000:01:00.0: Raw DCB entry 2: 01011312 00000000
[    3.758382] [drm] nouveau 0000:01:00.0: Raw DCB entry 3: 020223f1 0084c080
[    3.758390] [drm] nouveau 0000:01:00.0: Parsing VBIOS init table 0 at offset 0xDDBE
[    3.758773] [drm] nouveau 0000:01:00.0: Parsing VBIOS init table 1 at offset 0xE0A4
[    3.775111] tuner-simple 2-0061: creating new instance
[    3.775116] tuner-simple 2-0061: type set to 38 (Philips PAL/SECAM multi (FM1216ME MK3))
[    3.777147] IRQ 16/ivtv0: IRQF_DISABLED is not guaranteed on shared IRQs
[    3.777474] ivtv0: Registered device video0 for encoder MPG (4096 kB)
[    3.777505] ivtv0: Registered device video32 for encoder YUV (2048 kB)
[    3.777529] ivtv0: Registered device vbi0 for encoder VBI (1024 kB)
[    3.777554] ivtv0: Registered device video24 for encoder PCM (320 kB)
[    3.777578] ivtv0: Registered device radio0 for encoder radio
[    3.777580] ivtv0: Initialized card: Hauppauge WinTV PVR-150
[    3.777610] ivtv: End initialization



-Install ivtv-utils using package manager

(utilities for use with the ivtv kernel driver)

$ which ivtv

ivtv-ctl        (to switch inputs ed.) 
ivtv-mpegindex  
ivtv-radio      
ivtvfwextract   
ivtvplay        
ivtv-tune     (to tune frequencies)

-Test /dev/video0 whether the ivtv driver operates, after 5 seconds ctrl-C:

$ cat /dev/video0 > 208.mpg
$ mplayer test.mpg

We should now have an movie of 5 seconds

-Swith to another channel/frequency

$ ivtv-tune -f 216.00
/dev/video0: 216.000 MHz  (Signal Detected)

$ cat /dev/video0 > 216.mpg
$ mplayer test.mpg


$ mplayer /dev/video0
$ mplayer -vf pp=lb /dev/video0


(http://lists.mplayerhq.hu/pipermail/mplayer-users/2006-February/058296.html)
(http://www.linuxquestions.org/questions/linux-software-2/getting-tv-card-to-work-is-proving-to-be-troublesome-541152/)
(http://www.uluga.ubuntuforums.org/showthread.php?t=108826)
(https://bugs.launchpad.net/ubuntu/+source/linux/+bug/228363)

/usr/bin/v4l2-ctl -d /dev/video0 --set-audio-input=0

google: mplayer use of pvr
use of mplayer' pvr  option
http://lists.mplayerhq.hu/pipermail/mplayer-users/2006-December/064435.html



mplayer pvr:// -tv channel=E11:

http://archives.free.net.ph/message/20080129.144444.267a04bb.en.html

http://ohioloco.ubuntuforums.org/showthread.php?t=1491854

http://linuxcentre.net/vlc-bbc-iplayer-integration-using-get_iplayer-pvr-manager


(also ? libvideo ivtv perl)

ivtv-tune -f 208.000

mencoder /dev/video0  -quiet -ovc copy -oac copy of mpeg -o test.mpg


--- werkt
$ ivtv-tune -f 208.000
/dev/video0: 208.000 MHz  (Signal Detected)

$ mplayer /dev/video0 -vo xv

(geeft beeld en geluid)

---



-Install vlc (vlc-nox) ed. using package manager

https://videolan.org/doc/streaming-howto/en/index.html


http://sourceforge.net/projects/pvr/


http://marksnotebook.com/PVR-150_capture


!!!
http://www.mailinglistarchive.com/html/mplayer-users@mplayerhq.hu/2006-12/msg00179.html


Radio:

dit werkt:

http://ivtvdriver.org/index.php/Howto:Gentoo


ksh> ivtv-radio -f 98.4 
set to freq 98.40
Running: aplay -f dat < /dev/video24
Playing raw data 'stdin' : Signed 16 bit Little Endian, Rate 48000 Hz, Stereo


werkt dit ook:

ksh> ivtv-radio -j 102.6 &   ;-- the & will start this as a background process
[3] 11914
ksh>  arecord -D hw:0,0 -d 3600 -f dat ~/bbc3.dat; kill -9 11914
Recording WAVE '/home2/rec/bb3.dat' : Signed 16 bit Little Endian, Rate 48000 Hz, Stereo


http://www.stolk.org/debian/pvr350.html

------------------
Creating a user tomcat in the group w95
---

http://embraceubuntu.com/2005/09/07/adding-a-startup-script-to-be-run-at-bootup/
http://linux-sxs.org/internet_serving/c140.html

-Perform the user admin for tomcat.

-create a group named 'tomcat'

$sudo groupadd tomcat

-set up a 'nologin'-shell
-does this 'nologin-shell' allready exists?
$sudo less /etc/shells | grep nologin

-when 'nologin' is not in the output, create a nologin-shell
$sudo echo "/usr/sbin/nologin" >> /etc/shells

-or edit the file /etc/shells and pu the line  /usr/sbin/nologin   at the bottem

-create a user tomcat which default group is tomcat and other group is w95, and which does not have a login shell, and which has a home-dir tomcat
$sudo useradd -s /bin/false -g tomcat -G w95 -c tomcat -m -d /home/tomcat tomcat

$sudo passwd tomcat

-The tricky part: edit the /etc/passwd file and remove the login in shell formuser tomcat

$more /etc/passwd

tomcat:x:1004:1005:tomcat:/home/tomcat:/bin/false

should become:

tomcat:x:1004:1005:tomcat:/home/tomcat:

-Test if you can become tomcat

$sudo su - tomcat
password for flip:

-enter your 'sudo' password

$id
uid=1004(tomcat) gid=1005(tomcat) groups=1004(w95),1005(tomcat)

-The id is 'tomcat' so that works

-End of Perform the user admin for tomcat
---------------------------

---------
-creating start and stop script

-edit a startup script with the name startup, like this

#!/bin/bash

export CATALINA_HOME=/usr/local/apache-tomcat-6.0.29
##export CATALINA_BASE=$CATALINA_HOME/8880
#export CATALINA_OPTS="-Xms512M -Xmx1024M"
export JAVA_HOME=/usr/lib/jvm/java-6-openjdk
##export CLASSPATH=$CLASSPATH:$CATALINA_BASE/conf

CATALINA_HOME/bin/startup.sh


-edit a shutdown script like this

#!/bin/bash

export CATALINA_HOME=/usr/local/apache-tomcat-6.0.29
#export CATALINA_BASE=$CATALINA_HOME/8880
export JAVA_HOME=/usr/lib/jvm/java-6-openjdk

$CATALINA_HOME/bin/shutdown.sh


-make a web directory like:

$cd /
$sudo mkdir web
$cd web
$sudo mkdir 8180

-put the startup script in these directories

-set ownership okay

$chown -R tomcat:w95 /web/8180/

----
create a boot startup script, like

#!/bin/sh
# Tomcat start/stop/restart scripts

case "$1" in
'start')
        su - tomcat /web/8180/bin/startup > /dev/null 2>&1 < /dev/null
        su - tomcat /web/8280/bin/startup > /dev/null 2>&1 < /dev/null
        ;;

'stop')
        su - tomcat /web/8180/bin/shutdown > /dev/null 2>&1 < /dev/null
        su - tomcat /web/8280/bin/shutdown > /dev/null 2>&1 < /dev/null
        ;;

'restart')
        $0 stop
        exec $0 start
        ;;

*)
        echo "Usage: /etc/init.d/tomcat { start | stop }"
        ;;
esac

exit 0

-copy that into /etc/init.d
$cd .etc.init.d
$sudo ~pim/bin/tomcat .

-make it executable

$sudo chmod +x tomcat

-now create the neccary start up links with:

$sudo update-rc.d tomcat defaults









-set these scripts to 'executable'



-updating permissions in the tomcat directories

$cd /usr/local

$sudo chown -R tomcat:w95 tomcat/