What is the best solution to get values known in shell into the C binary application during its run-time?
The C application communicates with third party product and sends it actual settings.
But some settings are changed directly in OS, so I want to use some command from shell to influence, change, these variables in C application.
Do you know some way for achieving it (using variable, pipes, or maybe something differently other)?
I looked at global variables, but even though I change global variable value, it has no effect in C application which was running all time. (I used function getenv()).
Most long running processes (aka. daemon) in Unix have some kind of configuration files (e.g.
/etc/mydaemon.conf) which they read (and evaluate)HUPsignal.So the most easiest and well-known way is to install a signal handler in the C app and catch SIGHUP signals. This of course requires changes to the C app.
To trigger a reread in the shell you can use one of these commands: