Solved

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

Posted on 2014-04-18
6
1,174 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 34

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 61

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
What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

 
LVL 14

Accepted Solution

by:
small_student earned 500 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 27

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 to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

Linux users are sometimes dumbfounded by the severe lack of documentation on a topic. Sometimes, the documentation is copious, but other times, you end up with some obscure "it varies depending on your distribution" over and over when searching for …
This article will explain how to establish a SSH connection to Ubuntu through the firewall and using a different port other then 22. I have set up a Ubuntu virtual machine in Virtualbox and I am running a Windows 7 workstation. From the Ubuntu vi…
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:

706 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now