running shell script as service
- From: "iPerfect" <nkanthikiran@xxxxxxxxx>
- Date: 10 Nov 2006 02:34:00 -0800
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
.
- Prev by Date: FTP anonymous
- Next by Date: lonetar vs rsync
- Previous by thread: FTP anonymous
- Next by thread: lonetar vs rsync
- Index(es):
Relevant Pages
|