Solved

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

Posted on 2014-04-18
6
1,220 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
What Is Blockchain Technology?

Blockchain is a technology that underpins the success of Bitcoin and other digital currencies, but it has uses far beyond finance. Learn how blockchain works and why it is proving disruptive to other areas of IT.

 
LVL 14

Accepted Solution

by:
Monis Monther 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 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

Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

Question has a verified solution.

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

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 …
In the first part of this tutorial we will cover the prerequisites for installing SQL Server vNext on Linux.
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.:
Suggested Courses

635 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