LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 04-19-2006, 03:29 AM   #1
fab_lab_99
LQ Newbie
 
Registered: Mar 2006
Posts: 6

Rep: Reputation: 0
Scripts to manage processes and services


Hi everyone,
I am working with Nagios under Red Hat Enterprise AS
Nagios uses some addons like nsca or nrpe, to monitor remote servers.
They are common processes that I can start or stop via executabel, say 'nrpe -c nrpe.cfg'
Now, I would like to create scripts in order to make the management of such processes easier. I would like to be able to do a 'nrpe start', 'nrpe stop' and 'nrpe status', for instance. Also, I would like the system to automaticcally start these services at runlevel 3. I am not a bash programmer, and I would like to find a book or something similar with some script samples and a minimal theory of startup and shutdown scripts under red hat. I don't want to learn the entire bash programming - if possible! - but something more specifical. I have 'Advanced Bash Scripting Guide', but it's too huge for my aims and there are not examples of startup scripts.
Anyone can suggest me something ?
 
Old 04-19-2006, 04:57 AM   #2
timmeke
Senior Member
 
Registered: Nov 2005
Location: Belgium
Distribution: Red Hat, Fedora
Posts: 1,515

Rep: Reputation: 61
Have a look at the scripts in /etc/init.d.
Most of them cover options like "start", "stop", "status" etc.
They are fairly simple Bash scripts, so with the help of your guide, you should be able to understand them.
If you still have trouble or questions, don't hesitate to post back.

You can use /sbin/chkconfig (see it's man page for details) to make your system start certain services (represented by scripts in /etc/init.d) when entering any runlevels you like.
It requires that you put a special comment at the top of the script to indicate the order in which you start the services (ie the service launch order).

Code:
/sbin/chkconfig --list
gives a list of all currently installed services and the runlevels they're configured to run in.

Edit: when you've successfully created the /etc/init.d script, you can launch/stop the service by typing:
Code:
/sbin/service name_of_script start
/sbin/service name_of_script stop

Last edited by timmeke; 04-19-2006 at 04:58 AM.
 
Old 04-19-2006, 05:17 AM   #3
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
Also, if you didn't install from rpm you *still* can extract the initscript from the rpm, test and use it.
 
Old 04-20-2006, 02:35 AM   #4
fab_lab_99
LQ Newbie
 
Registered: Mar 2006
Posts: 6

Original Poster
Rep: Reputation: 0
Ok. thank you all. Have you any suggestion about further readings I could afford ? Books or online articles ?
 
  


Reply



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 On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
How do I add/remove/manage services from the CLI? neocookie Fedora 3 11-24-2005 10:01 AM
Manage services seriesx4 Ubuntu 1 11-06-2005 09:04 AM
An Application to Manage Scripts LinuxBlackBox Linux - Software 7 09-16-2004 04:02 PM
monitoring active processes and identifying the required processes. gajaykrishnan Programming 2 08-13-2004 01:58 AM
kolab: manage coexistence with other services Clemente Linux - Software 0 02-11-2004 09:59 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 03:02 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