Go Premium for a chance to win a PS4. Enter to Win

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,250 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
6 Comments
 
LVL 36

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
Prepare for your VMware VCP6-DCV exam.

Josh Coen and Jason Langer have prepared the latest edition of VCP study guide. Both authors have been working in the IT field for more than a decade, and both hold VMware certifications. This 163-page guide covers all 10 of the exam blueprint sections.

 
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 31

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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

The purpose of this article is to fix the unknown display problem in Linux Mint operating system. After installing the OS if you see Display monitor is not recognized then we can install "MESA" utilities to fix this problem or we can install additio…
In part one, we reviewed the prerequisites required for installing SQL Server vNext. In this part we will explore how to install Microsoft's SQL Server on Ubuntu 16.04.
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial
Suggested Courses
Course of the Month9 days, 16 hours left to enroll

927 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