Apache tomcat startup script not booting at startup.


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Apache tomcat startup script not booting at startup.
# 1  
Old 01-23-2014
Apache tomcat startup script not booting at startup.

I copied the script from an AskUbuntu post -

Code:
#!/bin/bash

### BEGIN INIT INFO
# Provides:        tomcat7
# Required-Start:  $network
# Required-Stop:   $network
# Default-Start:   2 3 4 5
# Default-Stop:    0 1 6
# Short-Description: Start/Stop Tomcat server
### END INIT INFO

PATH=/sbin:/bin:/usr/sbin:/usr/bin

start() {
 sh /usr/share/tomcat7/bin/startup.sh
}

stop() {
 sh /usr/share/tomcat7/bin/shutdown.sh
}

case $1 in
  start|stop) $1;;
  restart) stop; start;;
  *) echo "Run as $0 <start|stop|restart>"; exit 1;;
esac


The script can be started manually, but it doesn't execute on bootup.

Could it be because I've to change the "PATH=/sbin:/bin:/usr/sbin:/usr/bin " ?
I am using Tomcat6 though.

Everything is the same, I have only modified the start and stop variables to suit my install directory as follows :
Code:
start() {
 sh /home/drg/Desktop/apache/bin/startup.sh
}

stop() {
 sh /home/drg/Desktop/apache/bin/shutdown.sh
}


Last edited by Franklin52; 01-23-2014 at 10:36 AM.. Reason: adding code tags
# 2  
Old 01-23-2014
Please post your environment; operating system, version, etc.

To make anything start at boot time you (or the install routine) will need to enter it in a startup script somewhere (eg, a file in /etc/rc3.d), unless you're running an O/S that's clairvoyant you will need to tell it what to do.

Last edited by hicksd8; 01-23-2014 at 10:53 AM..
# 3  
Old 01-23-2014
Quote:
Originally Posted by hicksd8
Please post your environment; operating system, version, etc.

To make anything start at boot time you (or the install routine) will need to enter it in a startup script somewhere (eg, a file in /etc/rc3.d), unless you're running an O/S that's clairvoyant you will need to tell it what to do.
Oops sorry forgotten about that.

OS : LinuxMint 16 64bit
Environment : Cinnamon ?

I added the relevant symlinks in the rc.* directories via the following commands :

Code:
chmod 755 /etc/init.d/tomcat7 
update-rc.d tomcat7 defaults

# 4  
Old 01-23-2014
Yep, so you obviously know more than enough to fix your problem.

You said that you can start it manually so you can decide where in the boot order it should start and put the same command into rc3 script.

Reboot the system to check whether it starts okay or errors out.

Last edited by hicksd8; 01-23-2014 at 12:19 PM..
# 5  
Old 01-23-2014
Quote:
Originally Posted by hicksd8
Yep, so you obviously know more than enough to fix your problem.

You said that you can start it manually so you can decide where in the boot order it should start and put the same command into rc3 script.

Reboot the system to check whether it starts okay or errors out.

Job done.
No, I am not familiar with Linux bash scripting and the boot order like you said =/.

I simply followed instructions I found online, but it didn't work.

update-rc.d tomcat7 defaults
The above code should result in the tomcat7 script being set the correct boot order automatically ?
# 6  
Old 01-23-2014
Well I'm not familiar with LinuxMint 16 64bit but the multi-user startup scripts are usually in /etc/rc3.d (or perhaps in your O/S /etc/rc.d).

Take a look in there and list the files present. Is there a Tomcat? Use grep to search for it. If the command you used entered the required script you should see it (or at least a link to the file elsewhere).

If all else fails you could simply create a file SnnTomcat for example and put your Apache start command in there (where nn is a number setting the appropriate position in the boot sequence). Make the script executable.

I expect another member who knows LinuxMint better will respond and help you out shortly.
# 7  
Old 01-23-2014
The problem might also be the init level, type who -r to know what is your default level... then be sure the start link is in that rc.*d and put the stop in one level lower...
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Startup script

I can't quite find a clear answer on how to properly write a start up script. Does anybody have any ideas?? (3 Replies)
Discussion started by: Huitzilopochtli
3 Replies

2. Shell Programming and Scripting

Automatic shutdown and startup of Tomcat in Solaris

Dear Experts , I want to stop and Start tomcat at the time of shutdown and startup of our server . I was trying to stop tomcat with following command # su - dm -c "/export/home/Finder/FinderWeb/jakarta-tomcat-3.3.1a/bin/shutdown.sh" but i am getting following error. Please suggest .... (1 Reply)
Discussion started by: Amit.saini333
1 Replies

3. Shell Programming and Scripting

Single Startup script for Apache/jboss

Hi, I have apache ,jboss and jon instances on various linux boxes.I need to create a generic startup script to restart those instances on server reboot.The script requirement is : It should take the name of instances from one text file named active-servers and recycle those instances. 1.... (6 Replies)
Discussion started by: saurau
6 Replies

4. Shell Programming and Scripting

how to delete files at booting of system (system startup)

hi all I have a problem how to write a shell script which delete files/folder form directory whenever system boot and copy last updated folder/file in the specified directory.pse help me ASAP. i write a script which copy files in directory.I want when system boot up using script it check whether... (1 Reply)
Discussion started by: shubhig15
1 Replies

5. Shell Programming and Scripting

Apache Startup Fails with PHP Error

Great tins massive! Im Manqoba from Midrand, South Africa... I have installed Apache and PHP on a solaris 9 box, using the packages below: apache-2.2.14-sol9-sparc-local php-5.2.13-sol9-sparc-local After installing the packages I edited my httpd.conf file, to load the php5 module when... (10 Replies)
Discussion started by: Macarena S.A
10 Replies

6. UNIX for Dummies Questions & Answers

Startup Script Somewhere ?

Hello there! I need help. Everytime I login to my ssh, i see this: -bash: .export: command not found -bash: .export: command not found -bash: .export: command not found -bash: .export: command not found any help ? thanks (0 Replies)
Discussion started by: fbauto1
0 Replies

7. Shell Programming and Scripting

Solaris Startup script for Apache.

I'm running Solaris 5.9 and Apache 2.... I've created a startup script for Apache....but it doesn't work!!! it resides in /etc/init.d and has a link to /etc/rc3.d and if it run it as /etc/init.d/apache_start stop it stops the httpd services and /etc/init.d/apache_start start starts the... (3 Replies)
Discussion started by: Zak
3 Replies

8. Shell Programming and Scripting

Startup script

New in Unix, I am adding a line "route add 57.14.y.y 57.14.x.x" every day after rebooting the system. Where can I add the line so during boot up (the system is re-started every day by design (???) the line is executed? (I tried the /etc/rc2.d/S90 but for some reason the line needs to be added... (2 Replies)
Discussion started by: texaspanama
2 Replies

9. UNIX for Dummies Questions & Answers

Run tomcat at startup

Is it possible to run tomcat automatically when Linux boots without having to log in? (4 Replies)
Discussion started by: Spetnik
4 Replies
Login or Register to Ask a Question