Running system command

C

Chip

Hi and thanks in advance for your help.

I am trying to restart a Squid Proxy server
within a C cgi program.

I have added the following:
system("/usr/local/squid/sbin/squid -k reconfigure");

but get this error in the log file when I run the program:
"squid: ERROR: Could not send signal 1 to process 19175: (1) Operation not
permitted"

I have also tried:
system("su squid -c /usr/local/squid/sbin/squid -k reconfigure");
but get this error:
"su: must be run from a terminal"

How should I run the "/usr/local/squid/sbin/squid -k reconfigure" command?

Apache runs as nobody.nobody and Squid runs as squid.users
but the squid executable is chmod to 755.

Any and all help is greatly appreciated.

Chip
 
N

Nudge

Chip said:
I am trying to restart a Squid Proxy server
within a C cgi program.

I have added the following:
system("/usr/local/squid/sbin/squid -k reconfigure");

but get this error in the log file when I run the program:
"squid: ERROR: Could not send signal 1 to process 19175: (1) Operation not
permitted"

I have also tried:
system("su squid -c /usr/local/squid/sbin/squid -k reconfigure");
but get this error:
"su: must be run from a terminal"

How should I run the "/usr/local/squid/sbin/squid -k reconfigure" command?

I'd try the squid-users mailing list.
http://www.squid-cache.org/mailing-lists.html
 
N

Nick Keighley

Chip said:
I am trying to restart a Squid Proxy server
within a C cgi program.

I have added the following:
system("/usr/local/squid/sbin/squid -k reconfigure");

this question isn't on topic here. This news group is concerned
with the C langauge and not with platform specific extensions.

I suggest you repost your question in a suitable Unix ng. Try
something like comp.unix...

<snip>
 
C

CBFalconer

*** topposting corrected ***
Chip said:
Thanks for your help.

I needed to change userid with: setuid(1002);

For future reference, please do not toppost in c.l.c, and please do
observe topicality. While "system" is a part of standard C,
"squid" is definitely not, nor is setuid etc.

Some useful references about C and c.l.c:
<http://www.ungerhu.com/jxh/clc.welcome.txt>
<http://www.eskimo.com/~scs/C-faq/top.html>
<http://benpfaff.org/writings/clc/off-topic.html>
<http://anubis.dkuug.dk/jtc1/sc22/wg14/www/docs/n869/> (C99)
<http://www.dinkumware.com/refxc.html> (C-library}
<http://gcc.gnu.org/onlinedocs/> (GNU docs)
<http://clc-wiki.net> (C-info)

--
"The power of the Executive to cast a man into prison without
formulating any charge known to the law, and particularly to
deny him the judgement of his peers, is in the highest degree
odious and is the foundation of all totalitarian government
whether Nazi or Communist." -- W. Churchill, Nov 21, 1943
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,780
Messages
2,569,611
Members
45,286
Latest member
ChristieSo

Latest Threads

Top