Search code examples
linuxbashtftpinetd

Terminating TFTPD after file transfer


I am using inetutils tftpd which is started via inetd using the following entry in inetd.conf:

tftp       dgram   udp     wait    root   /bin/tftpd -p -u root -s /home

(ignore the use of root account and /home directory, it's just for testing purposes, it will be changed later).

inetd version is inetd (GNU inetutils) 1.7

tftpd version is tftp-hpa 5.2, with remap, with tcpwrappers

Everything works fine, but the problem is that I don't have any information about the file transfer status. Having in mind that I have more than 10 scripts that rely on tftpd, I need to either:

  • terminate tftpd after the file transfer or error (because it keeps running in the background doing nothing)

  • make it display file transfer status in a way that I can grep sed or at least $?

Is this possible, and if not, what other tftpd server should I use?


Solution

  • From the man page for tftpd:

    --timeout timeout, -t timeout

    When run from inetd this specifies how long, in seconds, to wait for a second connection before terminating the server. inetd will then respawn the server when another request comes in. The default is 900 (15 minutes.)

    Try changing your inetd.conf like so:

    tftp       dgram   udp     wait    root   /bin/tftpd -t 5 -p -u root -s /home
    

    Then restart inetd and test.