0

I've prepared a script that accepts a request on a server port, then process user input, provides an output through the same port and then dies. The script is not always running but starts when a a certain port is open by the client. The (working) configuration on my Linux machine is this one:

/etc/services
    test_socket   9876/tcp    # TestSocket

/etc/xinetd.d/test_socket
    # default: on
    # description: blah blah blah
   service test_socket
   {
      port        = 9876
      socket_type = stream
      protocol    = tcp
      wait        = no
      user        = root
      server      = /export/home/stefano/do_something.php
      instances   = 20
   }

Once a client open port :9876, the 'do_something.php' script starts accepting incoming message, process it and give a result as output before to die and close communication.

I would like to migrate/replicate the above architecture to Solaris 10 machine.

For the purpose I've configured the same value on same services file:

/etc/services
    test_socket   9876/tcp    # TestSocket

But then... being the inetd.d dismissed on Solaris10 and replaced by svc, how can I create a manifest to reproduce the same behavior?

I've tried to search documentation but I wasn't able to find out anything that has start on demand when client ask to communicate through server port.

Can anybody help me?

1 Answers1

1

You first need to create an inetd.conf style file with your configuration. This should be pretty straightforward, something like:

test_socket stream tcp nowait root /export/.../do_something.php do_something.php

Then run that command to import that service description to smf.

inetconv -i inetd.conf-style-file

Should you want to first have a look to what would be created without importing it, you can run:

inetconv -n -i inetd.conf-style-file -o /tmp

Note that once imported to smf, you administrate the service throught the inetadm command, e.g.:

inetadm -e svc:/network/test_socket/tcp:default # enable the service
inetadm -d svc:/network/test_socket/tcp:default # disable the service
inetadm -l svc:/network/test_socket/tcp:default # list the service properties
jlliagre
  • 8,691
  • 16
  • 36