Pete's Linux Advent Calendar 2008
The 20th day
Your own Internet Service
The program inetd allows you to easily create your own service.
First create a script that will print on stdout the string to
display when it will be called:
#!/bin/bash
echo hello, world
save this script for example as /usr/local/sbin/hello.
Then add this to /etc/services:
hello 4711/tcp
Finally add this line to /etc/inetd.conf:
hello stream tcp nowait nobody /usr/sbin/tcpd /usr/local/sbin/hello
Make inetd reload its configuration file with pkill -1 inetd.
Now if you connect to port 4711 on your server:
$ nc yourserver 4711
hello, world