I am creating a C program that is called from a shell script when a specific event occurs. Program C receives an argument from a shell script as follows:
> ./c-program.bin HELLO
Now the C program runs until it receives a specific character as an argument. The problem is that if a second event occurs, and the C program is now called like this:
./c-program.bin WORLD
Then this is a new instance of the program that starts, which does not know anything about the line from the first event. What I would like to achieve looks something like this:
[EVENT0] ./c-program.bin HELLO
[EVENT1] ./c-program.bin WORLD
[EVENT2] ./c-program.bin *
c-program output:
HELLO WORLD
Any ideas on how to have only one instance of the program? The platform is Linux. Thus, the project is in the planning phase, I do not have a specific code yet, I first try to deal with various problems.