running shell script as service



Hi All,

I have gone through the following steps to make shell script as a
service. As I was experimenting I used port 5555 but later when i used
7777 it doesnt work as before. I tried using random port numbers from
the available free/private ports . Still had no luck. Please correct me
if I am wrong in the following steps. All this is for forwarding tail
of apache log file to specific port.

regards,
Kanthi

******* Steps I followed **********

Creating the script "apache_monitor.sh"to monitor Apache log file

1) vi /usr/bin/apache_monitor.sh
2) Add the below lines to make the script.

#! /bin/sh
/usr/bin/tail -f -c -1 /var/log/httpd/access_log

3) Save the file and issue the following UNIX command to make the file
executable:
chmod 755 /usr/bin/apache_monitor.sh

---------------------------------------------------------------------
Creating the configuration file to run the above script as service

The steps below are required to make a script run as service

1) vi /etc/services

2) Add the following line to the bottom of this file

monitor_apache 5555/tcp
3) Execute the following steps to make config file :

a) cd /etc/xinetd.d
b) vi apache_mon
c) Write the following lines into the file
service apache_monitor
{
socket_type = stream
protocol = tcp
wait = no
user = root
server = /usr/bin/apache_monitor.sh
port = 5555
}
d) save the file and exit
e) Restart the xinetd service with the following command
/etc/init.d/xinetd restart

.



Relevant Pages

  • Re: How to Create a TCP/IP PrinterPort on a MS Cluster 2k3 via Scr
    ... XP is not in the cluster so I'm not clear on the failure question. ... the user running the script should be admin on the remote print server. ... thus the creation of the port on the node. ...
    (microsoft.public.windows.server.clustering)
  • Re: How to Create a TCP/IP PrinterPort on a MS Cluster 2k3 via Scr
    ... XP is not in the cluster so I'm not clear on the failure question. ... the user running the script should be admin on the remote print server. ... thus the creation of the port on the node. ...
    (microsoft.public.windows.server.clustering)
  • Firewall Rules Summary
    ... Subject: Firewall Rules Summary ... This script is provided "as is" with no implied warranty. ... this came from various howtos and articles on iptables that existed around ... #specific port denies>1024 tcp ...
    (Focus-Linux)
  • Re: How to Create a TCP/IP PrinterPort on a MS Cluster 2k3 via Scr
    ... I think Edwin is using the prnport.vbs script from the OS what uses the WMI ... thus the creation of the port on the node. ... NOT in de cluster resource! ... virtualPrinter in MSCS. ...
    (microsoft.public.windows.server.clustering)
  • Re: reverse ssh
    ... > logged into either box) can use the tunnel for whatever connects to it. ... > I suggest you connnect back to your home system's 'sshd' port and then you ... > will have to satisfy the home box's login authorization to get access ... > password from your script. ...
    (freebsd-questions)