How to change the output-format of the daytime xinetd service

Solution Verified - Updated -

Environment

  • Red Hat Enterprise Linux 5.5
  • daytime service over xinetd

Issue

Migrating from Tru64 to Red Hat Enterprise Linux 5 requires that the daytime protocol behaves the same on RHEL5 as compared to Tru64. On Tru64 the output of daytime has the following format:

Wed Sep 22 08:51:56 2010 

On RHEL5, the format looks like this:

22 SEP 2010 09:34:47 CEST 

How can daytime be configured so that RHEL5 gives the same format as Tru64?

Resolution

Create a script that displays the time in the correct format, for example /usr/local/bin/tru64-date:

#!/bin/sh
date +"%a %b %d %T %Y"

After that, change the configuration provided by the xinetd package in /etc/xinetd.d/daytime-stream:

service daytime
{
        disable         = no
        id              = daytime-stream
        type            = UNLISTED
        port            = 13
        user            = root
        wait            = no
        socket_type     = stream
        server          = /usr/local/bin/tru64-date
}

After making these changes, restart the xinetd service:

# service xinetd restart

Check if the output is correct now:

$ telnet localhost 13

This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.

Comments