-
April 18th, 2011, 06:05 AM
#1
[RESOLVED] run background process without &
hi,
I ve written a Makefile for my c++ files. in that i create targets for server and client. i ve to run the server in the background.but wen i execute the target i should not be using & ie, "./server& " should not be used.. instead i should execute as " ./server " but it has to run at the background....Can any one tell me how i should do this pls....
-
April 18th, 2011, 10:30 AM
#2
Re: run background process without &
-
April 18th, 2011, 11:59 AM
#3
Re: run background process without &
hi,,
thankx for response.. but the link u sent me is a normal file... can u help me out with some make files so that i can modify my file....
-
April 18th, 2011, 02:03 PM
#4
Re: run background process without &
If your application does not run in the background automatically (fork/setsid), then you have to tell the shell to run the app in the background for you. Make uses "sh" as the default shell. It uses "&" to run things in the background.
>> "./server& " should not be used.
Why? That's how you tell the shell to run it in the background...
gg
-
April 18th, 2011, 11:36 PM
#5
Re: run background process without &
thankx for the reply....i m new to this sh commands...so can u pls tell me exactly how shud i run my executable...
sh ./server is it.... and what is the modification i have to do to my makefile or is there anythin i got to include with it....
and der is one more this my executable is a binary executable..so wil there be problem using sh...
Can u pls tell me exactly how to use sh for binary executable...
Last edited by sandy2511; April 18th, 2011 at 11:47 PM.
Reason: did not tell it wa a binary executable..
-
April 19th, 2011, 12:40 AM
#6
Re: run background process without &
hi,
The binary 'server' should be a daemon binary.
(ie)
The binary should run as back-ground process by default.
(i.e, without specifying '&' symbol)....
This is what my question was exactly....
-
April 19th, 2011, 09:29 AM
#7
Re: run background process without &
>> The binary 'server' should be a daemon binary.
How to do that was given in post #2.
Call fork(), exit() and setsid().
gg
-
April 25th, 2011, 12:38 AM
#8
Re: run background process without &
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|