[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....
Re: run background process without &
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....
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
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...
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....
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
Re: run background process without &