V
V
vlzemtsov2016-02-08 19:54:43
linux
vlzemtsov, 2016-02-08 19:54:43

How to process incoming messages in Linux?

Given:
CentOs 6.5 minimal
Some port (let it be 7777) sometimes receives messages like either 'Ok' or 'Error'.
It is necessary that when the 'Error' message arrives on the port, the script '/opt/omgErrorNoPLS.sh' is executed.
The idea that came to my mind, but I don't really know how to implement it:
Raise on the nhinx server with php support. In php describe:

<?php
if (message=='Error')
  exec('/opt/omgErrorNoPLS.sh');
?>

(Not very sure about what is written above). The main problem is that I don't understand how to make php process exactly the string that arrived in one packet on 7777.
Thanks in advance for your help.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Alexander Movchan, 2016-02-08
@vlzemtsov

Python has a nice built- in socket library .

V
Vlad Zhivotnev, 2016-02-09
@inkvizitor68sl

inetd, xinetd.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question