I am new to monkey webserver, and to cgi, and am having a lot of trouble making things work.
My goal is to have a cgi script that generates a single line of javascript, containing my device's public IP.
The code I have looks like this:
$this->bbcode_second_pass_code('', '
#!/usr/bin/bash
echo Content-type: text/javascript
echo ""
localip=$(curl ifconfig.me)
echo "var ip='$localip';"
')
it seems to work when I run it with bash directly, but in monkey, it gets downloaded as a file, rather than executed.
I installed monkey with pacman -Sy monkey, then uncommented the cgi plugin in /etc/monkey/plugins.load, then created a folder in /srv/http/ called cgi-bin, then saved that script as ip.sh, and ran monkey in daemon mode.
help?
