Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Error in Daemon/Service app while compiling

Error in Daemon/Service app while compiling

Scheduled Pinned Locked Moved Unsolved General and Desktop
daemonservicewindowslinuxassert
16 Posts 3 Posters 5.1k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S SGaist
    27 Oct 2017, 20:47

    On what OS are you running that ?

    A Offline
    A Offline
    ainu
    wrote on 30 Oct 2017, 05:57 last edited by
    #6

    @SGaist I ran it on Linux ( Ubuntu 16.04 LTS ) but intend to run on Windows either.

    A 1 Reply Last reply 30 Oct 2017, 06:19
    0
    • A ainu
      30 Oct 2017, 05:57

      @SGaist I ran it on Linux ( Ubuntu 16.04 LTS ) but intend to run on Windows either.

      A Offline
      A Offline
      ainu
      wrote on 30 Oct 2017, 06:19 last edited by
      #7

      Actually the situation changed a bit and i managed to run without the error i had in the beginning. In the program there are some possible ways to follow, depending on the set flag ( i set flag: Projects->Run->Command line arguments ). everything seems to work fine with all the flags except the ones that make program to be installed. In this case it falls into infinite-loop. It looks as if it continuously trying to install itself without success ( i mean it was installed on the second iteration, not the first. Which is also weird ). The part of the code i am talking about

      if ( !( ptrCtl->isInstalled() ) ) {
                      qDebug() << ptrCtl->serviceName() << " was not installed ==================== >>>";
                      qDebug() << ptrCtl->serviceName()
                               << ( ( ptrCtl->install( getProgName() ) )
                                    ? " was successfully" : " was not " ) <<  "installed";
      
                      qDebug() << getProgName()
                               << ( ( ptrCtl->start() )
                                    ? " was" : " was not " ) <<  "started";
      }
      

      The program goes into the first if-statement every time but only on the second iteration it installs and all the other times do not do this and certainly never reaches the line with call to "start"-method ( at least not calling to "start"-method ). After the second iteration it looks as if it creates new process branch every time the program stream reaches this line ( with "install"-method ) and started to walk all its way through the main function to "install"-method again.
      I added the line with the phrase "was not installed" just to make the output more readable. The output looks like this

      "d_server" was not installed ==================== >>>
      "d_server" was successfully installed
      "d_server" was not installed ==================== >>>
      "d_server" was not installed ==================== >>>
      "d_server" was not installed ==================== >>>

      There is also another strange thing happens. The first iteration of this infinite-loop contain only 2 parameters for main function ( I mean argc in "int main( int argc, char **argv )" equals 2 ) but all the following - 4. Interesting why is it so?!
      My question here is how to make the program to install itself from the beginning and go to the line with "start-method"? ( well do it without "infinite"-loop ).

      Thank you in advance for any help.

      A 1 Reply Last reply 30 Oct 2017, 08:19
      0
      • A ainu
        30 Oct 2017, 06:19

        Actually the situation changed a bit and i managed to run without the error i had in the beginning. In the program there are some possible ways to follow, depending on the set flag ( i set flag: Projects->Run->Command line arguments ). everything seems to work fine with all the flags except the ones that make program to be installed. In this case it falls into infinite-loop. It looks as if it continuously trying to install itself without success ( i mean it was installed on the second iteration, not the first. Which is also weird ). The part of the code i am talking about

        if ( !( ptrCtl->isInstalled() ) ) {
                        qDebug() << ptrCtl->serviceName() << " was not installed ==================== >>>";
                        qDebug() << ptrCtl->serviceName()
                                 << ( ( ptrCtl->install( getProgName() ) )
                                      ? " was successfully" : " was not " ) <<  "installed";
        
                        qDebug() << getProgName()
                                 << ( ( ptrCtl->start() )
                                      ? " was" : " was not " ) <<  "started";
        }
        

        The program goes into the first if-statement every time but only on the second iteration it installs and all the other times do not do this and certainly never reaches the line with call to "start"-method ( at least not calling to "start"-method ). After the second iteration it looks as if it creates new process branch every time the program stream reaches this line ( with "install"-method ) and started to walk all its way through the main function to "install"-method again.
        I added the line with the phrase "was not installed" just to make the output more readable. The output looks like this

        "d_server" was not installed ==================== >>>
        "d_server" was successfully installed
        "d_server" was not installed ==================== >>>
        "d_server" was not installed ==================== >>>
        "d_server" was not installed ==================== >>>

        There is also another strange thing happens. The first iteration of this infinite-loop contain only 2 parameters for main function ( I mean argc in "int main( int argc, char **argv )" equals 2 ) but all the following - 4. Interesting why is it so?!
        My question here is how to make the program to install itself from the beginning and go to the line with "start-method"? ( well do it without "infinite"-loop ).

        Thank you in advance for any help.

        A Offline
        A Offline
        ainu
        wrote on 30 Oct 2017, 08:19 last edited by
        #8

        maybe important to mention that i did saw the same question on Stack Overflaw and try to use it in my project

        1 Reply Last reply
        0
        • S Offline
          S Offline
          SGaist
          Lifetime Qt Champion
          wrote on 30 Oct 2017, 23:00 last edited by
          #9

          Are you trying to install it with root privileges ?

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          A 1 Reply Last reply 31 Oct 2017, 06:14
          0
          • S SGaist
            30 Oct 2017, 23:00

            Are you trying to install it with root privileges ?

            A Offline
            A Offline
            ainu
            wrote on 31 Oct 2017, 06:14 last edited by ainu
            #10

            @SGaist thank you. it might be the point of course but it also rises a few questions:

            • why my app was installed once ( second iteration ) at least it was shown that it was installed.
            • how to give to the app root privileges? ( i mean of course i tried ( from console ) to use make and then sudo ( super user privileges ) on compiled file but it changed nothing so i might did something wrong. If there are other options how to give root ( or super user privileges ) privileges write me please ).
            1 Reply Last reply
            0
            • S Offline
              S Offline
              SGaist
              Lifetime Qt Champion
              wrote on 31 Oct 2017, 22:26 last edited by
              #11
              1. You might have been working as root at some point
              2. What I meant was, as you did, use sudo for the installation.

              Interested in AI ? www.idiap.ch
              Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

              A 1 Reply Last reply 1 Nov 2017, 08:41
              0
              • S SGaist
                31 Oct 2017, 22:26
                1. You might have been working as root at some point
                2. What I meant was, as you did, use sudo for the installation.
                A Offline
                A Offline
                ainu
                wrote on 1 Nov 2017, 08:41 last edited by
                #12

                @SGaist I see, it seems there is some other issue then. Regretfully of course, as i still have no clue of what to do.
                Anyway thank you for your help.

                1 Reply Last reply
                0
                • S Offline
                  S Offline
                  SGaist
                  Lifetime Qt Champion
                  wrote on 1 Nov 2017, 23:19 last edited by kshegunov
                  #13

                  On a side note, you might also be interested by @kshegunov QtDaemon module.

                  [Fixed hyperlink ~kshegunov]

                  Interested in AI ? www.idiap.ch
                  Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                  A 1 Reply Last reply 2 Nov 2017, 06:30
                  0
                  • S SGaist
                    1 Nov 2017, 23:19

                    On a side note, you might also be interested by @kshegunov QtDaemon module.

                    [Fixed hyperlink ~kshegunov]

                    A Offline
                    A Offline
                    ainu
                    wrote on 2 Nov 2017, 06:30 last edited by
                    #14

                    @SGaist thank you for the link

                    K 1 Reply Last reply 3 Nov 2017, 14:30
                    0
                    • A ainu
                      2 Nov 2017, 06:30

                      @SGaist thank you for the link

                      K Offline
                      K Offline
                      kshegunov
                      Moderators
                      wrote on 3 Nov 2017, 14:30 last edited by
                      #15

                      I've been silent, because it's been a long time since I had used the QtService and I really don't remember how it's supposed to be set up. As for linux, depending on how the daemon's set up you may need to call insserv to register the init script.

                      Read and abide by the Qt Code of Conduct

                      A 1 Reply Last reply 7 Nov 2017, 05:00
                      1
                      • K kshegunov
                        3 Nov 2017, 14:30

                        I've been silent, because it's been a long time since I had used the QtService and I really don't remember how it's supposed to be set up. As for linux, depending on how the daemon's set up you may need to call insserv to register the init script.

                        A Offline
                        A Offline
                        ainu
                        wrote on 7 Nov 2017, 05:00 last edited by
                        #16

                        @kshegunov Thank you for your suggestion I will try to follow it.

                        1 Reply Last reply
                        0

                        15/16

                        3 Nov 2017, 14:30

                        • Login

                        • Login or register to search.
                        15 out of 16
                        • First post
                          15/16
                          Last post
                        0
                        • Categories
                        • Recent
                        • Tags
                        • Popular
                        • Users
                        • Groups
                        • Search
                        • Get Qt Extensions
                        • Unsolved