Webserver on bash + inetd
It took me to respond to http requests from the outside and somehow process them (connected to express payment terminals). The first solution was on Nginx + FastCGI (PHP), which was somewhat unreasonably heavy. And here old memories visited me and thanks to ru_root in LiveJournal and Google, the following was done:
By this we explained to the server that on port 433 we now have a service named freecashpayment.
So we force listening to port 433 and respond to it with the script freecashpayment.sh
As a result in the script in the variable $ url we have all the parameters that were sent to us in the GET request. echo will output to us everything that is necessary in the answer.
We are very happy :)
[root@mysql-02 /etc]# cat services | grep freecashpayment
freecashpayment 433/tcp
freecashpayment 433/udp
[root@mysql-02 /etc]# cat inetd.conf | grep freecashpayment
freecashpayment stream tcp nowait root /usr/home/firefly/freecashpayment.sh freecashpayment.sh
[root@mysql-02 /usr/home/firefly]# cat freecashpayment.sh
#!/usr/local/bin/bash
read request
while /usr/bin/true; do
read header
[ "$header" == $'\r' ] && break;
done
url="${request#GET }"
url="${url% HTTP/*}"
echo $url