LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Red Hat (https://www.linuxquestions.org/questions/red-hat-31/)
-   -   Configuring Shell Script as service/daemon (https://www.linuxquestions.org/questions/red-hat-31/configuring-shell-script-as-service-daemon-499028/)

nkanthikiran 11-06-2006 02:59 AM

Configuring Shell Script as service/daemon
 
Hi All,

I have script to tail the log file of httpd-access_log file.
How can i configure the same script as service using xinetd. I need to
run service for the specific port i would like to listen.

Thank you
Kanthi Kiran

unSpawn 11-06-2006 04:19 AM

How can i configure the same script as service using xinetd. I need to run service for the specific port i would like to listen.
Here is an example using "who". Working with your script should be similar. Steps:

I. Register port in local services database.
echo "test tcp/34463" >> /etc/services
Test with "getent services test".

II. Make sure firewall accepts connection to port TCP/34463 FOR LOCAL SUBNET ONLY. After all this is an example. For this example we used subnet 10.1.1.0/24.

III. create /etc/xinetd.d/test with contents:
Code:

# default: off
# description: The TEST service allows remote users to access TCP/34463 (max server port in Xinetd).
# 10.1.1.0 localnet
service test
{
        disable = no
        socket_type = stream
        wait  = no
        user = nobody
        server = /usr/bin/who
        server_args = --heading --dead -u --login --lookup --process --time --mesg --users
        log_on_success -= HOST
        log_on_failure += HOST
        interface = 10.1.1.2
        instances = 1
        only_from = 127.0.0.1 10.1.1.0/24
}

and replace:
- 10.1.1.2 with the IP address of your ethernet device.
- 10.1.1.0/24 with the IP subnet IP of your ethernet device.
(Re)start Xinetd.
Test with "nc IP_address 34463" or send your browser to "http://IP_address:34463".


BIG FAT WARNING
- Do not make such services publicly accessable unless you understand the implications. Make use of Xinetd's restrictive features like cps, max load, rlimit cpu, shield the port using Xinetd's "only_from" and your firewall regardless AND TEST BEFORE DEPLOYING,
- Do not allow the service to interact with remote user input EVER,
- Do monitor your Xinetd log.


HTH

nkanthikiran 11-07-2006 05:50 AM

Thank You.
I am done with my requirement and your reply was additional support for my documentation

Thank you once again


All times are GMT -5. The time now is 11:32 PM.