Qt World Summit: Register Today!

How can I instantiate a daemon application in linux to startup automatically once linux boots

  • Hi,
    I want to make my console base Qt (5.2) application running as a daemon in my ubuntu linux(64bit) environment,I have successfully compiled the sample code "httpserver" that comes with QtService

    But I do not know how to use that daemonized application as service in linux.
    I would be happy if one could answer following questions:
    1- How shall I call the executable file properly from terminal? "httpserver -i 8080" or "service httpserver start" or "httpserver start"
    2- Why as soon as I run the executable in the terminal the executable httpserver does not close and logout from terminal after running.

    3- How can I extract the PID number of the daemon httpserver since I want to use it with monit
    while the monit application ,in fact monitors the _/var/run/ folder for daemons processes PIDs.

    4- How can I confirm that by top or htop that my process has not *tty * or user shell as its parent process, (the child has obtained his own SID and detached successfully from its parent )

    5-How and where should I place the httpserver executable with its shared libraries to make the application work in its proper working directory.(How can I change the daemon process working directory)

    Thanks in advance

Log in to reply