I have a shell script (csh) - I didn't write it so I can't change it now. The script does a lot of parsing of log files, calls other scripts in languages like Perl and Tcl, creates new files and calls executables. It runs nicely from the command line.
I would like to be able to run the script from a HTML form (I can do that), work normally and output the text that usually goes to the terminal to a web browser instead.
I'm on Ubuntu 10.10 and have installed lighttpd 1.4.26. The script just needs one single variable passed to it from the HTML.
It doesn't work properly.
- I linked the
conf-enabled. This should enable CGI, it appears to do so.
- I commented out the
lighttpd.conf. This apparently lets the server run scripts as "root".
- I created a small script that takes the query string, parses it and calls the real useful script.
Here are the problems I'm having:
pwdand it prints out the correct directory. However it won't actually use that path when writing files with '>'. I need to manually add the entire path for every file access of this nature - why?
There is no PATH defined, so none of the commands like
ifconfigetc work. I added a hard-coded PATH= , that seems to work but even then some commands simply don't work. I copied the same PATH as the one I have at an interactive shell. Is there a length limit? Why is there no PATH?
Related to all this is that when calling executables, they seem to be confused as to where they are since relative paths ../../ don't work any more.
I have a feeling that this is some kind of user permission or interactive vs non-interactive problem.
One important note is that this will never be on the web, just running locally on a small setup with a few qualified users. Security is not a concern, really.