0

I normally have to run the start up script for apache and tomcat manually every time my SuSE machine start by issue command /opt/apache-tomcat-8.0.24/bin/startup.sh. Is there a way I can set for this script to run auto automatically every time the machine startup?

Thank you,

2 Answers2

2

Copy the file /etc/init.d/skeleton and rename it to /etc/init.d/your-service. After that edit this file to create new scripts. the comments in this file are used by Yast to describe on which runlevels the start/stop must be.

The script will then show in YaST → System → System Services (runlevel), you can the enable it using chkconfig to create the appropriate links

chkconfig --set your-service on

you can also activate it in some runlevels using

chkconfig --level 35 someservice on

to desactivate the service you can use

chkconfig --set your-service off

Dababi
  • 3,355
  • 24
  • 23
1

Beginning with SuSE 12 distros (including SLES12), SuSE has implemented systemd.

systemd is (disputably) meant to eventually replace SysV init scripts on Linux.

SuSE 12 distros continue to support both SysV init scripts, as well as the new systemd.

However, it is likely that your desire to automatically start Tomcat on each system boot has already been anticipated by SuSE; which already has a systemd entry in SuSE 12 distros.

Hence, on SuSE 12 distros, Tomcat automatic start can be enabled in:

YaST->System->Services(Manager)->Tomcat

YaST Tomcat Enable (Automatic Start)

Click the Enable/Disable button to enable or disable automatic startup.

Also, you might find the following command-line item of value:

systemctl status tomcat
systemctl start tomcat
systemctl stop tomcat

(More commands can be found in man systemctl.)