Ive got my program in C, 6 source files, and the aim is to copy those files to any other Linux OS computer, and (probably compile, im newbie, so not sure what is needed here) run this program in background. Something like:
user@laptop:~$ program
Program is running in a background. In order to stop Program, type
XXX.
Any tips on this?
Thanks in advance!
Put a
daemon(0,0);call in your C program.stopping it is a bit trickier, I suppose there is only one copy of the program running. Put the program’s PID in a file, write another utility (
XXX) which reads the PID from the file and kills it.Important:
daemonforks, get the PID of the program after calling daemon.But maybe you are too newby and just want to execute your program with
program&and laterkillit.