Here is the one to restart squid. I am not sure whether or not I still need to Sudo to root to make it work, but that is how I initially set it up.
#!/bin/bash
# # URL of server # base_url="wpl-fs1"
# # base address of squidguard blacklists # base_db_address="/usr/lib/squidGuard/blacklists"
echo "Content-Type: text/html; charset=ISO-8859-1" echo -e "\n" cat << EOF <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css"> body { background-color: #FFFFFF; } h1,h2,h4,td,th { font-family: Verdana,Arial,Helvetica,sans-serif; color: #000000; font-weight: normal; text-decoration:none} h1 { font-size: 16pt; }
h4 { font-size: 18pt; }
pre { color: #000000;
font-size: 10pt;
font-family: Lucida Console, sans-serif;Fixed;
font-weight:normal;font-style:normal;
text-decoration: none; }
</style></head>
<body>
echo "<h4>Reconfigure Squid Daemon</h4><pre>`sudo -u root squid -k reconfigure`</pre>"
echo "<hr>"
error=$?
if [ $error <> 0]; then
echo "<pre>return code: $error <font color="red"> (error in reconfiguration attempt)</font></pre>"
else
echo "<pre>return code $error (reconfigure successful)<pre>"
fi
echo "<hr>"
echo "</body>"
echo "</html>"
Hope this helps - let me know if you need more info.
Mark Ehle
Computer Suppport Lilbrarian Willard Public Library Battle Creek, Michigan
Jim O'Hern wrote:
I realize there are various packages already created that allow you to work with SquidGuard via the web but I wanted to try something that I felt would be simple. Using Apache Webserver and PHP4, I wanted to update various *.diff files, then send the commands: 'squidGuard -u, and squid -k reconfigure' through the web. I can update the diff file with no problem, but I am either unable to (1) execute 'squidGuard -u', or (2) execute 'squid -k reconfigure', or (3) both.
In PHP4, I'm using:
system("squidGuard -u",$ret1);
system("squid -k reconfigure","$ret2);
Upon completion of this part, the error code for $ret1 is 127. The error code for $ret2 is 1. This leads me to believe that it is the squidGuard -u command that is failing, although I could not find the meanings to the error codes.
I suspect that this is a file/directory permissions issue.
Should I be looking at ownership issues for squidGuard? Currently, it is owned by 'squid'. The PHP file that is attempting to execute these commands is also owned by squid. I wonder if I should make it owned by Apache? What I'm trying to do should not be too difficult, but...
If anyone can offer help, I'd appreciate it.
Jim O'Hern
Scotland County Schools, NC
