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. Run as service
Forum Updated to NodeBB v4.3 + New Features

Run as service

Scheduled Pinned Locked Moved Solved General and Desktop
windowsservice
13 Posts 6 Posters 12.2k Views 5 Watching
  • 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.
  • mrjjM Offline
    mrjjM Offline
    mrjj
    Lifetime Qt Champion
    wrote on last edited by
    #3

    hi
    alternatively u could just cheat and use a tool to run it as service.
    http://www.howtogeek.com/50786/using-srvstart-to-run-any-application-as-a-windows-service/

    1 Reply Last reply
    1
    • K kuzulis

      I can't find something useful for me.

      Perhaps, because you lazy looking for?
      QtService: https://github.com/qtproject/qt-solutions

      M Offline
      M Offline
      Max13
      wrote on last edited by
      #4

      @kuzulis said:

      Perhaps, because you lazy looking for?

      I found this but while I'm struggling with an error on make g++: error: CreateProcess: No such file or directory, I still hoping there is something included in Qt. Maybe my error is related to the fact that I'm on 5.6 (and the project mentions 5.5), but that's another thread.

      @mrjj said:

      alternatively u could just cheat and use a tool to run it as service.

      I also thought about this at first (like the included sc, as command line), but as the app will run on around 30 computers and will be installed by users, I need a simple workflow. So either a simple command line tool that will be run on the first start by my app (after install) or the above solution provided by @kuzulis (or similar)

      We all have started by asking questions. Then after some time, we can begin answering them.

      kshegunovK 1 Reply Last reply
      0
      • mrjjM Offline
        mrjjM Offline
        mrjj
        Lifetime Qt Champion
        wrote on last edited by
        #5

        @Max13 said:

        g++: error: CreateProcess:

        is that mingw compiler?

        Oh, i understand. To Make installer to setup the app as service is
        as much work as making native a service. :)

        1 Reply Last reply
        0
        • ? Offline
          ? Offline
          A Former User
          wrote on last edited by
          #6

          Why don't you just run ping from a cron job?

          M 1 Reply Last reply
          0
          • M Max13

            @kuzulis said:

            Perhaps, because you lazy looking for?

            I found this but while I'm struggling with an error on make g++: error: CreateProcess: No such file or directory, I still hoping there is something included in Qt. Maybe my error is related to the fact that I'm on 5.6 (and the project mentions 5.5), but that's another thread.

            @mrjj said:

            alternatively u could just cheat and use a tool to run it as service.

            I also thought about this at first (like the included sc, as command line), but as the app will run on around 30 computers and will be installed by users, I need a simple workflow. So either a simple command line tool that will be run on the first start by my app (after install) or the above solution provided by @kuzulis (or similar)

            kshegunovK Offline
            kshegunovK Offline
            kshegunov
            Moderators
            wrote on last edited by
            #7

            @Max13
            What OS are we talking? I recently began (and implemented for Linux) such a thing (Qt 5.5 compatible). My idea is that at some point I wrap up the Windows code as well.

            Read and abide by the Qt Code of Conduct

            1 Reply Last reply
            0
            • the_T Offline
              the_T Offline
              the_
              wrote on last edited by
              #8

              I recently wrote a windows service (file transfer from/to a server, connection checks,...) in plain C compiled with mingw but it a bit of pain (so much code to type...)

              @Max13 said:

              I also thought about this at first (like the included sc, as command line), but as the app will run on around 30 computers and will be installed by users, I need a simple workflow. So either a simple command line tool that will be run on the first start by my app (after install) or the above solution provided by @kuzulis (or similar)

              As far as i remember you need full Admin rights (on Win7 it was not enough to run the CMD as administrator when logged in as a normal user) to register/install a service. I was looking for installer kits that can do that but could not find any examples for this.

              -- No support in PM --

              1 Reply Last reply
              1
              • ? A Former User

                Why don't you just run ping from a cron job?

                M Offline
                M Offline
                Max13
                wrote on last edited by
                #9

                @mrjj said:

                is that mingw compiler?

                Oh, i understand. To Make installer to setup the app as service is
                as much work as making native a service. :)

                It's mingw, installed with Qt. It's easier for the user (therefor for me, if I don't have to help them) if I make an installer that installs (as a service) and start. Then the user has NOTHING to do except double clicking the installer.

                @Wieland said:

                Why don't you just run ping from a cron job?

                It's not just really a ping. Currently it's calling an API to say "I'm still awake", the plan is to "ping" with a some logs.

                @kshegunov said:

                What OS are we talking?

                Windows XP and Windows 7. QtSolutions was a great idea. If you have implemented yours another, share.

                @the_ said:

                I recently wrote a windows service (file transfer from/to a server, connection checks,...) in plain C compiled with mingw but it a bit of pain (so much code to type...)

                I don't doubt it. I want to avoid native APIs as much as possible. To keep the cross-platform ability

                Finally, I managed to compile QtSolutions/QtService using just the cmd command line by Qt. All the env variables was there. It's a little bit complicated to understand the first time how to implement it, as there is only examples, but I simply has to wrap my code in an overridden QtService::start() and that's it.

                My project is Open Source: https://github.com/Max13/Pulse-Qt

                Thank you for your help

                We all have started by asking questions. Then after some time, we can begin answering them.

                kshegunovK 2 Replies Last reply
                1
                • M Max13

                  @mrjj said:

                  is that mingw compiler?

                  Oh, i understand. To Make installer to setup the app as service is
                  as much work as making native a service. :)

                  It's mingw, installed with Qt. It's easier for the user (therefor for me, if I don't have to help them) if I make an installer that installs (as a service) and start. Then the user has NOTHING to do except double clicking the installer.

                  @Wieland said:

                  Why don't you just run ping from a cron job?

                  It's not just really a ping. Currently it's calling an API to say "I'm still awake", the plan is to "ping" with a some logs.

                  @kshegunov said:

                  What OS are we talking?

                  Windows XP and Windows 7. QtSolutions was a great idea. If you have implemented yours another, share.

                  @the_ said:

                  I recently wrote a windows service (file transfer from/to a server, connection checks,...) in plain C compiled with mingw but it a bit of pain (so much code to type...)

                  I don't doubt it. I want to avoid native APIs as much as possible. To keep the cross-platform ability

                  Finally, I managed to compile QtSolutions/QtService using just the cmd command line by Qt. All the env variables was there. It's a little bit complicated to understand the first time how to implement it, as there is only examples, but I simply has to wrap my code in an overridden QtService::start() and that's it.

                  My project is Open Source: https://github.com/Max13/Pulse-Qt

                  Thank you for your help

                  kshegunovK Offline
                  kshegunovK Offline
                  kshegunov
                  Moderators
                  wrote on last edited by kshegunov
                  #10

                  @Max13 said:

                  Windows XP and Windows 7. QtSolutions was a great idea. If you have implemented yours another, share.

                  Currently only for Linux. I have some old source for windows that I'm going to refactor, but I've been busy ... you know how it is.

                  Read and abide by the Qt Code of Conduct

                  1 Reply Last reply
                  1
                  • M Max13

                    @mrjj said:

                    is that mingw compiler?

                    Oh, i understand. To Make installer to setup the app as service is
                    as much work as making native a service. :)

                    It's mingw, installed with Qt. It's easier for the user (therefor for me, if I don't have to help them) if I make an installer that installs (as a service) and start. Then the user has NOTHING to do except double clicking the installer.

                    @Wieland said:

                    Why don't you just run ping from a cron job?

                    It's not just really a ping. Currently it's calling an API to say "I'm still awake", the plan is to "ping" with a some logs.

                    @kshegunov said:

                    What OS are we talking?

                    Windows XP and Windows 7. QtSolutions was a great idea. If you have implemented yours another, share.

                    @the_ said:

                    I recently wrote a windows service (file transfer from/to a server, connection checks,...) in plain C compiled with mingw but it a bit of pain (so much code to type...)

                    I don't doubt it. I want to avoid native APIs as much as possible. To keep the cross-platform ability

                    Finally, I managed to compile QtSolutions/QtService using just the cmd command line by Qt. All the env variables was there. It's a little bit complicated to understand the first time how to implement it, as there is only examples, but I simply has to wrap my code in an overridden QtService::start() and that's it.

                    My project is Open Source: https://github.com/Max13/Pulse-Qt

                    Thank you for your help

                    kshegunovK Offline
                    kshegunovK Offline
                    kshegunov
                    Moderators
                    wrote on last edited by kshegunov
                    #11

                    @Max13
                    Hello,
                    Just letting you know that as of today I have an implementation for Windows as well. Still tweaking it a bit (the installation/ deinstallation should update the PATH), but it appears to be fully functional otherwise. Let me know if you're interested.

                    I just merged the win32 branch, so you can get the library here.

                    Kind regards.

                    Read and abide by the Qt Code of Conduct

                    M 1 Reply Last reply
                    2
                    • kshegunovK kshegunov

                      @Max13
                      Hello,
                      Just letting you know that as of today I have an implementation for Windows as well. Still tweaking it a bit (the installation/ deinstallation should update the PATH), but it appears to be fully functional otherwise. Let me know if you're interested.

                      I just merged the win32 branch, so you can get the library here.

                      Kind regards.

                      M Offline
                      M Offline
                      Max13
                      wrote on last edited by
                      #12

                      @kshegunov said:

                      Just letting you know that as of today I have an implementation for Windows as well.

                      I'm playing around with QtService, but I'll look at yours as soon as I can ;)

                      We all have started by asking questions. Then after some time, we can begin answering them.

                      kshegunovK 1 Reply Last reply
                      0
                      • M Max13

                        @kshegunov said:

                        Just letting you know that as of today I have an implementation for Windows as well.

                        I'm playing around with QtService, but I'll look at yours as soon as I can ;)

                        kshegunovK Offline
                        kshegunovK Offline
                        kshegunov
                        Moderators
                        wrote on last edited by
                        #13

                        @Max13
                        Do let me know whether it's convenient to use, and of course suggestions are welcome. (bug reports please post on the issue tracker).

                        Read and abide by the Qt Code of Conduct

                        1 Reply Last reply
                        0

                        • Login

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