Autostart for ubuntu server

Posted on

Problem :

Here is the first part of my question. Splitted it because of rule “One topic – one question”. My third and main question is about configuring autostart for webserver and database. init.d scripts seems to be very heavy for my case. (Just run smth on startup.)

Solution :

First check whether tomact deamon is running or not using this command

[root@localhost ~]# chkconfig --list | grep -i tomcat
tomcat6         0:off   1:off   2:off   3:off   4:off   5:off   6:off

Here 0 1 2 3 4 5 6 means run levels

In my case in run level 5 tomcat is not running that’s why while tying service tomcat6 status its showing stopped

[root@ical ~]# service tomcat6 status
tomcat6 is stopped   

Now start the service permanently by using this command, permanent means no need to start the tomcat6 service Again and Again

To make it permanent use this is the command

[root@ical ~]# chkconfig tomcat6 on

Now check the service whether it is running or not

[root@ical ~]# chkconfig --list | grep -i tomcat
tomcat6         0:off   1:off   2:on    3:on    4:on    5:on    6:off

See in run level 5 its on (5:on)

[root@ical ~]# service tomcat6 start
Starting tomcat6:                                          [  OK  ]
[root@ical ~]# service tomcat6 status
tomcat6 (pid 2806) is running...                           [  OK  ]

After reboot check Again

Do the same for mongodb also