Can't run cgi-scripts

Discussion in 'Tomato Firmware' started by MrNova, Oct 15, 2013.

  1. MrNova

    MrNova Reformed Router Member

    I'm compiling recent builds from GIT (tomato-k26USB-1.28.MIPSR2-VPN) with standard plus VPN and extras. I've been trying to run custom scripts by placing them in the /www/ext/cgi-bin folder (both directly and by enabling jffs, placing script in /jffs, and linking to /www/ext/cgi-bin) and setting chmod +x.

    However when I attempt to run them I get a generic file not found error. For example I created a file "env.sh" and placed it in the folder a variety of different ways. I then try to go to http://routerip/ext/cgi-bin/env.sh, but I get an error ./tmp/.[RANDOMCHARS] line 5: /ext/cgi-bin/env.sh: not found

    I can run the file just fine by telneting in and running sh env.sh from command line. Any thoughts? Sample of the script below:

    #!/bin/bash

    echo Content-type: text/html
    echo ""

    cat << EOM
    <HTML>
    <HEAD><TITLE>File Output: /home/user1/public_html/text-file.txt </TITLE>
    </HEAD>
    <BODY bgcolor="#cccccc" text="#000000">
    <P>
    <SMALL>
    <PRE>
    EOM

    env

    cat << EOM
    </PRE>
    </SMALL>
    <P>
    </BODY>
    </HTML>
    EOM
     
  2. MrNova

    MrNova Reformed Router Member

    Doh stupid me. Needed to change top line to /sh instead of /bash :oops:
     
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice