top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

How to start a Daemon in the start (bootup) of Linux?

+2 votes
510 views
How to start a Daemon in the start (bootup) of Linux?
posted Nov 29, 2013 by Satish Mishra

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

2 Answers

+2 votes
 
Best answer

Simplest way to do it to invoke it from the script /etc/rc.local. Don't forget to background it if the daemon doesn't do it on its own.

answer Nov 29, 2013 by Jai Prakash
+1 vote

Either put the start and stop script in /etc/rc.local, or clone a start AND STOP script from one of the simpler ones in /etc/init.d/ and link chkconfig it on.

If you do the latter, be sure that you consider when to start - you don't want to start a network-related script before the network is up.

answer Nov 29, 2013 by anonymous
Similar Questions
0 votes

Pleas point me to a good source how to use that (with ubuntu and Tomcat 7)?

The internet is full of selfmade /etc/init.d/ scripts, but mostly it isn't used it as a real service (jsvc). Keyword: bin/*daemon.sh*
Even the books "Apache Tomcat 7" and "Tomcat 7 Essentials" are not talking about it.

On the docs I've found this [http://tomcat.apache.org/tomcat-7.0-doc/setup.html#Unix_daemon]:

cd $CATALINA_HOME/bin
tar xvfz commons-daemon-native.tar.gz
cd commons-daemon-1.0.x-native-src/unix
./configure
make
cp jsvc ../..
cd ../..

But what about:
* set env. variables (maybe: catalina.sh?, /etc/profiles?)
* adjust the heap size
* logging to the right directory (like: /var/log/tomcat/...)
* specifying the User: "tomcat"

+3 votes

I have a script which will start few daemon processes,
What i want is, After reboot this script should start with an argument.

Can anyone help?

+1 vote

I have an application and whenever i start it i want it to be started as daemon process.
How will i achieve that?

Below is the sample code:

#include<stdio.h>
main()
{
    while(1)
    {
             printf(" Do Some Task Here\n");
     }
}
+6 votes

I have following requirement -
1. A graceful shutdown should run my stop script.
2. On boot I should able to start a program i.e. via script.
3. There should be a way to start and stop the program via script.

Any pointers.

...