Inside my C code I call system
to have result from a bash command.
I.e. system("ps aux | grep my_prog | head -n 1")
All is fine when I run my program in foreground mode, but in production is a service, so I need to see the output of system
in syslog
, not on stdout
or stderr
.
I'm struggling to find the best and least painful option here. Is there a proper way to do it?