LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Red Hat
User Name
Password
Red Hat This forum is for the discussion of Red Hat Linux.

Notices


Reply
  Search this Thread
Old 11-06-2006, 02:59 AM   #1
nkanthikiran
LQ Newbie
 
Registered: Jun 2005
Posts: 10

Rep: Reputation: 0
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
 
Old 11-06-2006, 04:19 AM   #2
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3594Reputation: 3594Reputation: 3594Reputation: 3594Reputation: 3594Reputation: 3594Reputation: 3594Reputation: 3594Reputation: 3594Reputation: 3594Reputation: 3594
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
 
Old 11-07-2006, 05:50 AM   #3
nkanthikiran
LQ Newbie
 
Registered: Jun 2005
Posts: 10

Original Poster
Rep: Reputation: 0
Thank You.
I am done with my requirement and your reply was additional support for my documentation

Thank you once again
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
daemon Shell Script abdul_zu Linux - Newbie 10 10-10-2005 10:13 AM
configuring a cgi shell script to run keeg Linux - Newbie 1 06-09-2005 01:45 PM
start service - mail daemon Nishtya Linux - Newbie 0 04-24-2004 04:12 PM
adding a new daemon (service) vjenks Linux - Newbie 3 02-11-2004 07:31 PM
Service Monitoring Daemon (MON) PokerFace Programming 1 12-04-2002 11:31 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Red Hat

All times are GMT -5. The time now is 05:41 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration