tomcat automatically start in ubuntu

Automatic Tomcat Starting

To make tomcat automatically start when we boot up the computer, you can add a script to make it auto-start and shutdown.

sudo vi /etc/init.d/tomcat
 

Now paste in the following:

            # Tomcat auto-start
            # description: Auto-starts tomcat
            # processname: tomcat
            # pidfile: /var/run/tomcat.pid

            export JAVA_HOME=/usr/lib/jvm/java-6-sun

            case $1 in
            start)
            sh /usr/local/tomcat/bin/startup.sh
            ;;
            stop)
            sh /usr/local/tomcat/bin/shutdown.sh
            ;;
            restart)
            sh /usr/local/tomcat/bin/shutdown.sh
            sh /usr/local/tomcat/bin/startup.sh
            ;;
            esac
            exit 0
        

You’ll need to make the script executable by running the chmod command:

sudo chmod 755 /etc/init.d/tomcat

The last step is actually linking this script to the startup folders with a symbolic link. Execute these two commands and we should be on our way.

sudo ln -s /etc/init.d/tomcat /etc/rc1.d/K99tomcat
sudo ln -s /etc/init.d/tomcat /etc/rc2.d/S99tomcat
Advertisements

@basic command

Basic command line of ubuntu/linux operating system
1. to show list file:

$ ls -lsr


2. to swap directories to the previous working directory

$ cd -


3. to delete all files

$ rm *


4. to delete every instance of a matching filename pattern from the current directory

$ rm –rf filename.*


5. to display the file contents directly on the screen

$ more filename
$ less filename


6. to use ls –l to display a list of files but it keeps scrolling off the screen, you can pipe the output from the ls –l command into the input of the more command by using the | character.

$ ls -l | more


7. to save the output of that list directly into a file.

$ ls -l > output.txt


8. cat command to display the contents of that file, pipe that into the grep command and then redirect that output into a separate file:

$ cat nc6build.sh | grep sh > output.txt


9. to show recently used command

$ history


10. to loop through a set of filenames and perform an action on each one, you can use the for command to loop through a set of files.

$ for f in *.txt;do echo $f;done


11. to find all files with .txt in the name that were modified in the last 5 days.

$ find . –name "*.txt" –mtime 5


12. to quickly find text within files, even searching through subdirectories.

$ grep -ir "seraching text" *


13. to quickly rename files using a regular expression pattern. For instance, if you wanted to rename all files containing foo to contain bar instead, you could use a command like this one

$ rename –v 's/foo/bar/g' *


14. to see a list of system processes

$ ps aux

15. to kill the running process

kill 

16. unpack the archive/zip in any directory

tar xfz eclipse-jee-ganymede-SR1-linux-gtk.tar.gz

17. point a folder directory

ln -s /usr/home/palash/douments documents