Solved

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

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

 
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 29

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

Visualize your virtual and backup environments

Create well-organized and polished visualizations of your virtual and backup environments when planning VMware vSphere, Microsoft Hyper-V or Veeam deployments. It helps you to gain better visibility and valuable business insights.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
android secure ftp 3 74
expand ext4 on centos 6 5 56
RHEL installation problems on HP Proliant DL 360 G6 server 20 130
IP 10.0.1.2 / 255.0.0.0 61 80
In my business, I use the LTS (Long Term Support) versions of Linux. My workstations do real work, and so I rarely have the patience to deal with silly problems caused by an upgraded kernel that had experimental software on it to begin with from a r…
1. Introduction As many people are interested in Linux but not as many are interested or knowledgeable (enough) to install Linux on their system, here is a safe way to try out Linux on your existing (Windows) system. The idea is that you insta…
Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…

733 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