LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 07-20-2004, 10:16 PM   #1
JohnLocke
Member
 
Registered: Jun 2004
Location: Denver, Colorado
Distribution: Ubuntu
Posts: 229

Rep: Reputation: 30
Starting and killing services on system cycle:


Ok, I figured that to add a startup process (samba is what I'm working on), you can add that to the rc.local file in /etc/rc.d

Here's what I put in:

Code:
if ps -ef | grep mbd | grep -v grep ; then
    echo "smb processes already started"
else
    echo "starting smb processes..."
    /etc/rc.d/init.d/smb start
fi
I just put it down at the bottom after all the /etc/issue business (running a new install of MDK 9.2)

I figure it would be smart to have a kill script in the rc.6 directory as well ... but I don't know how to do that (or even if what I've done is "correct" even though it works ). All the files in rc.6 are linked files ... plus, smb doesn't want a "kill" signal per se (and as I understand it, the rc.6 files are simply sent a term signal?). I just want a script that'll say something to the effect of:

Code:
if ps -ef | grep mbd | grep -v grep ; then
    echo "cleaning up smb processes ..."
    /etc/rc.d/init.d/smb start
else
    echo "smb processes are already shut down."
fi
am I on the right track? Where to go next?
 
Old 07-20-2004, 10:41 PM   #2
Demonbane
LQ Guru
 
Registered: Aug 2003
Location: Sydney, Australia
Distribution: Gentoo
Posts: 1,796

Rep: Reputation: 47
Sorry but I don't really get what you're trying to do here, if you're trying to run smbd on startup can't you put it in the runlevels you desire?
 
Old 07-20-2004, 10:52 PM   #3
JohnLocke
Member
 
Registered: Jun 2004
Location: Denver, Colorado
Distribution: Ubuntu
Posts: 229

Original Poster
Rep: Reputation: 30
Erm ... I suppose I could. I guess that's part of my question. I'm not nearly 100% familiar with what the runlevels do ... do they simply send an init and term signal to the process you identify? For example, if I ln -s the smb init file to a Snn or Knn in one of the rc.X directories, I think it'll work, but is that correct to do?

Samba asks for you to run "smb xxx" where xxx is start, restart, or stop. I've heard people can just put them in the rc folders as a runlevel link, but I'd like to get in the habit of doing things correctly.

I guess in basic my question might be, /should/ you use the runlevels if the script you're starting asks for a command line input?
 
Old 07-20-2004, 11:49 PM   #4
Demonbane
LQ Guru
 
Registered: Aug 2003
Location: Sydney, Australia
Distribution: Gentoo
Posts: 1,796

Rep: Reputation: 47
If you want to know more about runlevels try this guide
http://www.icon.co.za/~psheer/book/index.html
particularly on chapter 32

For a quick answer yes you should have a dedicated script for starting a service on boot for a particular runlevel, though you don't have to, this makes it easier to manage.
for example if you want to add smb to the default runlevel(5 in Mandrake I think) instead of doing the symlinks manually you can use:
Code:
/sbin/chkconfig --level 5 smb on
 
Old 07-21-2004, 12:31 AM   #5
JohnLocke
Member
 
Registered: Jun 2004
Location: Denver, Colorado
Distribution: Ubuntu
Posts: 229

Original Poster
Rep: Reputation: 30
Good grief that's a long one! ha! Ok, I'll start reading that and get back to you.

For now, I redid it and currently have:
Code:
smb             0:off   1:off   2:off   3:on    4:off   5:on    6:off
(I changed the levels on them, though to start after network services were up and to be killed before network services went down) and took my script out of the rc.local
as it appears this is what everyone is telling me to do.

This seems to be working just fine. I guess my current question, then, is moot, but I'm still curious;
if using the runlevel starts and kills these things just fine ... does smb or network or eth0 or whatnot accept an init signal instead of the "start" "stop" or "restart" ... or do those simply echo a term and init signal to these scripts?

Thanks for the manual to look at!
 
Old 07-21-2004, 06:50 PM   #6
JohnLocke
Member
 
Registered: Jun 2004
Location: Denver, Colorado
Distribution: Ubuntu
Posts: 229

Original Poster
Rep: Reputation: 30
Sorry, I'm a moron ... didn't disable smilies /or/ preview my post. Just that section again:
Code:
smb             0ff   1ff   2ff   3n    4ff   5n    6ff
 
Old 07-21-2004, 07:49 PM   #7
JohnLocke
Member
 
Registered: Jun 2004
Location: Denver, Colorado
Distribution: Ubuntu
Posts: 229

Original Poster
Rep: Reputation: 30
Last time ... this time without the idiocy ....
Code:
smb             0:off   1:off   2:off   3:on    4:off   5:on    6:off
 
  


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
No sound in flashplayer-mozilla after killing and starting esd PatrickMay16 Ubuntu 0 10-03-2005 10:48 AM
Starting different services at boot mjjzf Slackware 2 05-21-2005 02:46 PM
KDE Hangs at Starting System Services... Snabber Linux - General 3 11-03-2004 08:31 AM
Starting services from terminal ExploiT Linux - General 4 09-18-2004 11:04 PM
Starting Services InEeDhElPlInUx Linux - Newbie 9 11-06-2003 12:57 PM


All times are GMT -5. The time now is 09:23 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration