Allow CLI output of service when requested

Viewed 26

I am forking a service that controls the fan PWM on a Raspberry PI based on temperature. Right now the program writes to a file every 1 second the temperature value, fan speed, and time ran. Because it is writing so little but often and most of the time it is information not being used by anything, I only need the output when asked for. One option is to have the service make a small RAM Disk that the file is stored on and read from (using 'watch' as mentioned in the original code). Is it possible instead to have the service run in a way that I can then run a command calling same service that then outputs the values with live updating. If so, what does that look like code-wise?

1 Answers

in case you're forking the service so you can custom it to your needs. use callback function to expose those info, then you can use this callback pointer to trigger it however you want. i can't provide more details since the question it self lacks details as well xD

Related