running shell command with apache
Is there a way to run a shell command from a website hosted on apache? I'm trying to figure out a way to restart my linux server with a web-interface...
|
you could create a cgi script in perl and use perl's exec or system function to execute a shell command or shell script. or you can just use a shell script and tell apache in the configuration file to treat something with a *.sh extension as a cgi script and execute it.
|
I think I like the cgi-version best, since I don't know anything about perl, but: is there a way to give some variables to a cgi script?
|
yes, you can always pass variables to a cgi script provided you write your code to look for the variables. the easiest way is to pass the variables (key/value pairs) to your script is by passing them inside the url seperating multiple variables (key/value pairs) by '&'.
ex. Code:
http://someplace.com/some_cgi.cgi?some_var1=some_val1&some_var2=some_val2 |
What would my script have to look like if I want it to run "shutdown -<var1> <var2>"?
|
All times are GMT -5. The time now is 05:48 PM. |