I want to execute a Linux shell command from “/sbin/” with execl or system (or another command), and hide its output.
I am using “fork” already to get a child process…
Like if I entered…
service "servicename" restart
I would see the output where it says “restarting xyz [OK]”. Instead, I simply want the command to be executed silently and its output discarded instead of being shown in my console application.
Redirect the output to
/dev/nullEg.,
service smb restart 1> /dev/nullservice smb restart 2> /dev/nullwhere
1and2represents thestdoutandstderr