Linux Services

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • HugoFromBOSS
    New Member
    • Sep 2007
    • 38

    Linux Services

    Hello,

    I am writing a service for Linux I have written all the code. Here's what’s wrong I hope you can help. When the service runs it checks several things, this need to be visible to the user. Afterward it listens on a port and because its listening it stop and doesn’t return the user to the shell it just carries on waiting. This is a problem when the server start as is obviously doesn’t complete the setup it stops and waits for the program to finish listening which it doesn’t. How can I get around this? I have tried "> /dev/null" it does work but hides all of the information to the user.

    Any ideas?

    Thanks
  • jabbah
    New Member
    • Nov 2007
    • 63

    #2
    maybe

    yourservice &

    is what your looking for?

    or rather

    nohup yourservice &

    Comment

    • HugoFromBOSS
      New Member
      • Sep 2007
      • 38

      #3
      When I use "nohup" it still waits instead of quiting.

      Comment

      • HugoFromBOSS
        New Member
        • Sep 2007
        • 38

        #4
        Also, question how do I create a pidfile when my app runs?

        Comment

        • jabbah
          New Member
          • Nov 2007
          • 63

          #5
          Originally posted by HugoFromBOSS
          When I use "nohup" it still waits instead of quiting.
          from what I understood you dont want it to quit, do you?

          putting an ampersand & at the end of the command line will make the process go to the background.

          e.g.

          sleep 3 &
          will go to the background and you have 3 seconds to do ps to see that the process is running.

          I dont remember precisely what nohup does but its got something to do with stop listening to signals, anyways man nohup will tell you.
          and while youre at, you may want to look at man fg and man bg

          Comment

          • HugoFromBOSS
            New Member
            • Sep 2007
            • 38

            #6
            Perfect thanks! It was & then sleep 3 :)

            Comment

            Working...