inIn Linux, RHEL-8.10 or later if it matters, I would like to write some C code that takes in various parameters and upon a certain condition issues a system("init 0") to shutdown the system. Before issuing the shutdown, I would like to throw a one line message into /var/log/messages that states system being shut down by ron's code so that I have a record of when that has happened.
How do you properly write into /var/log/messages ?
Obviously I can do an fopen("/var/log/messages, "a") and a simple fprintf but that seems like a bit of a hack.