I need to reload Squid daemon, the solution is:
system("/etc/init.d/squid reload\n");
but I think that there must be a more efficient solution than using the “system” call, what C instruction should I use?
Thank you very much.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You can use fork and exec if you really need a faster solution, but since the squid init script has to be run, and Squid has to do the work, any optimizations of your C program will only give a really marginal improvement.
EDIT:
On the other hand (after having looked at the Squid manual), some daemons react to signals, and Squid seems to do so. For example, it re-read its configuration files if you send a HUP signal to it: