We have a C application for Linux consisting of few modules. Each module can have some global config variables (some integers, strings etc.). The application is intended to run as a daemon for a long time.
What is the nicest way to reconfigure the app during run-time? Ideally, we would like to change somehow the content of those config-variables. Via /proc, inotify? What's the coolest, advanced way?
Sending a signal like SIGHUP which your program traps with a signal handler and does whatever it needs to do, like re-reading its configuration file, is a time-honored way of doing this. I can't call it a "coolest advanced" way, rather a practical and easy way. It is, for example, what happens when you want Apache's httpd daemon to re-read httpd.conf - it happens under the hood of service httpd reload.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With