There is a script (Ubuntu) .cgi ... it displays the Html page. In the html, the call of this script with the parameters is written like this (they work ok) day_detail.cgi?year=2013&month=07&day=07 . I want to make a conclusion in the textbook for personal needs. I do this through the shell: ./day_detail.cgi?year=2013&month=07&day=07 > /var/www/posmotr.txt - gives an error.

How? thank.

  • what mistake? - spirit
  • What do you keep in a script? Through the shell, it can be fired if this is the appropriate script. - spirit
  • root @ ubuntu-stat: / var / www / lightsquid. ? year = 2013: There is no such file or directory [1] - Exit 127 ./day_detail.cgi?year=2013 - fil23
  • Script from lightsquid - fil23
  • And correctly gives. Searches for the day_detail.cgi? Year ... file (etc.). And where will he find him? - alexlz

2 answers 2

You must first set the desired environment variables. At a minimum, REQUEST_METHOD and QUERY_STRING , but others may be needed by the script. Then run:

 #!/bin/bash export REQUEST_METHOD=GET export QUERY_STRING="year=2013&month=07&day=07" /path/to/script/directory/script.cgi 

Or, if you want to launch directly from the terminal, then try something like

 env REQUEST_METHOD=GET env QUERY_STRING="year=2013&month=07&day=07" ./script.cgi 

Of course, script.cgi should have + x.

    If I were you, I would run this script on a web server, and through it transfer the output to a file. But it all depends on what kind of script you have, on what is written and what exactly it does.

    • The script is not mine, it is a script from lightsquid (log analyzer). - fil23
    • Then you definitely need to wrap this thing through a web server. - spirit
    • on perl script - fil23