...

View Full Version : Executing linux shell script on the webserver



blackfish
07-12-2007, 09:04 AM
Hi,

I have devoloped a script to append data to a text file for my linux squid proxy server. The trouble I am now having is that I want to be able to run a shell script via a web browser that will reload the squid proxy service on the same server.

The shell script has the command to reload the squid proxy service using the following commands:

echo Reloading External Lists Please Wait...
service squid reload
echo Reload Complete
echo Proxy Ready

Is there any way to call this script and execute the shell script through PHP or is there a more suitable way, such as commands like system or exec??

Many Thanks,

BlackFish :thumbsup:

firepages
07-12-2007, 12:17 PM
more suitable would be a CRON job where you can run the script as root or whoever you wish.

assuming that you need to give the script elevated privileges then that means either running the webserver as a privileged user (not recommended) or adding PHP to sudoers or some SUID solution .. all messy



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum