Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

How do I get a service to start automatically in Ubuntu 12.04 server?

Posted on 2014-04-18
6
Medium Priority
?
1,232 Views
Last Modified: 2014-04-25
I've been task by my boss to come up with a solution for the below. I'm a Windows guy who is currently attending Linux classes, but find that it is truly a new world for me and difficult to grasp. Can any expert here who is a Linux/Ubuntu guru help me with the following below?


The task:
------------------
Linux guys

Below is a real exercise that we can apply at work.   Every time we reboot the Ubuntu 12.04 server we need to manually start the below services.

What would be the best method and how would you get this to start automatically after a successful boot.

I am using key words on the requirements (Similar to those on the Microsoft exams)

I know you can Google it and done with it.  However as you guys know we are shifting our production environment to Linux.  (Obviously the main reason you are on a Linux training)

So would be great if you come with the solution using the notes, book or learning that we have so far from the class.  

Please send me your solution not later than Monday afternoon.  I want to get this into our production Bamboo/stash server.



Here are the commands:

MySQL:
Cd /var/lib/mysql/
Sudo service mysql start

Stash:
Cd /home/nnguyen/atlassian-stash-2.10.2/bin/
Sudo ./start-stash.sh


Bamboo:
Cd /home/nnguyen/atlassian-bamboo-5.4.1/bin
Sudo ./start-bamboo.sh
0
Comment
Question by:5itface
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
6 Comments
 
LVL 35

Expert Comment

by:Seth Simmons
ID: 40009242
use:

update-rc.d <servicename> defaults

you also included RHEL in your topic list so just for reference for Red Hat/CentOS use:

chkconfig <servicename> on
0
 

Author Comment

by:5itface
ID: 40009979
So from the example above, can you help me type it as how it should be using the service names in my example? This will set it to auto start those services when the system has been rebooted regardless of who logs in or not?
0
 
LVL 62

Expert Comment

by:gheist
ID: 40010758
Mysqld - > your system includes mysql, so use it with all its startup scripts
Java services are best handled bu service-wrapper package (yes you need to rewrite startup scripts)
0
Is Your Team Achieving Their Full Potential?

74% of employees feel they are not achieving their full potential. With Linux Academy, not only will you strengthen your team's core competencies but also their knowledge of of the newest IT topics.

With new material every week, we'll make sure that you stay ahead of the game.

 
LVL 14

Accepted Solution

by:
Monis Monther earned 1500 total points
ID: 40010764
For Ubuntu

update-rc.d mysqld defaults

For RHEL/CentOS

chkconfig mysqld on

For the other services that you have the above commands would not work because they do not seem to have init scripts. Therefore you have to put them in the rc.local file

For RHEL/CentOS

under /etc/rc.d/rc.local put the following two lines


/home/nnguyen/atlassian-stash-2.10.2/bin/start-stash.sh
/home/nnguyen/atlassian-bamboo-5.4.1/bin/start-bamboo.sh

Under Ubuntu I think the file is under /etc/init.d/rc.local

Also type the two lines under the file and save it then run the following command

update-rc.d rc.local defaults
0
 

Author Comment

by:5itface
ID: 40011726
What is it meant by the init scripts?
0
 
LVL 30

Expert Comment

by:serialband
ID: 40011866
They mean initialization scripts.


Atlassian has instructions on how to set that up.  You should do it the way they've documented, so that you can get better support from them if you're paying for support.
https://confluence.atlassian.com/display/STASH/Running+Stash+as+a+Linux+service
https://confluence.atlassian.com/display/DOC/Start+Confluence+Automatically+on+Linux

https://confluence.atlassian.com/display/BAMBOO/Bamboo+installation+guide+for+Linux
https://confluence.atlassian.com/display/BAMBOO/Running+Bamboo+as+a+Linux+service

MySQL should have init scripts already.
0

Featured Post

How Blockchain Is Impacting Every Industry

Blockchain expert Alex Tapscott talks to Acronis VP Frank Jablonski about this revolutionary technology and how it's making inroads into other industries and facets of everyday life.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If you use Debian 6 Squeeze and you are tired of looking at the childish graphical GDM login screen that is used by default, here's an easy way to change it. If you've already tried to change it you've probably discovered that none of the old met…
Join Greg Farro and Ethan Banks from Packet Pushers (http://packetpushers.net/podcast/podcasts/pq-show-93-smart-network-monitoring-paessler-sponsored/) and Greg Ross from Paessler (https://www.paessler.com/prtg) for a discussion about smart network …
Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
Suggested Courses

664 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question