LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   How create daemon from program? (https://www.linuxquestions.org/questions/linux-software-2/how-create-daemon-from-program-754812/)

monolit 09-13-2009 09:29 AM

How create daemon from program?
 
Hello can you help me with following problem? I want to do daemon from usuall program like VNCserver. I think that I must get the program to the started scripts - is it right?

lutusp 09-13-2009 11:55 AM

Quote:

Originally Posted by monolit (Post 3680968)
Hello can you help me with following problem? I want to do daemon from usuall program like VNCserver. I think that I must get the program to the started scripts - is it right?

How To Setup Linux VNC Server In 3 Minutes

Using VNC And Redhat Linux

That should cover it.

catkin 09-13-2009 12:01 PM

Use the start-stop-daemon function in /lib/lsb/init-functions. Here's an example of using it from /etc/init.d/skeleton
Code:

do_start()
{
    # Return
    #  0 if daemon has been started
    #  1 if daemon was already running
    #  2 if daemon could not be started
    start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON --test > /dev/null \
        || return 1
    start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON -- \
        $DAEMON_ARGS \
        || return 2
    # Add code here, if necessary, that waits for the process to be ready
    # to handle requests from services started subsequently which depend
    # on this one.  As a last resort, sleep for some time.
}


monolit 09-13-2009 01:33 PM

Thank you boys:) ...but the lutusp report is concrete too:( ...and the catkin's report is too complicated:(( I found the posibillity in update-rc.d, btw I am Debian user...


All times are GMT -5. The time now is 03:25 PM.