Startup/Kill Scripts


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Startup/Kill Scripts
# 1  
Old 12-14-2009
Startup/Kill Scripts

Hello,

I have to perform an audit of a system at work and I am looking at its /etc/rc3.d:

Code:
K01tog-pegasus     K74nscd             S08iptables    S50openemm
K01yum             K74ntpd             S09isdn        S55cups
K02NetworkManager  K85mdmpd            S09pcmcia      S55sshd
K03rhnsd           K87auditd           S10network     S56rawdevices
K05saslauthd       K88wpa_supplicant   S12syslog      S56xinetd
K10dc_server       K89netplugd         S13irqbalance  S80sendmail
K10psacct          K89rdisc            S13portmap     S85gpm
K12dc_client       K90bluetooth        S14nfslock     S90crond
K15httpd           K94diskdump         S15mdmonitor   S93mysqld
K20nfs             K99readahead        S18rpcidmapd   S94httpd
K24irda            K99readahead_early  S19rpcgssd     S95anacron
K36mysqld          S00microcode_ctl    S25netfs       S95atd
K50netdump         S02lvm2-monitor     S26apmd        S97messagebus
K50tux             S05kudzu            S28autofs      S98haldaemon
K73ypbind          S05openibd          S40smartd      S99local
K74ipmi            S06cpuspeed         S44acpid       S99paNeuron

I notice that amost all the kill scripts do not have a corresponding start script and vice versa. Shouldn't a kill script have a corresponding start script and vice versa? Please explain.
# 2  
Old 12-14-2009
Typically you'll find that kill scripts are not run at the same run level as the start scripts.
You could check the output of:
Code:
ls -l /etc/rc?.d

# 3  
Old 12-14-2009
Quote:
Originally Posted by Scrutinizer
Typically you'll find that kill scripts are not run at the same run level as the start scripts.
You could check the output of:
Code:
ls -l /etc/rc?.d

I think am having problems understanding the basic idea begind the K and S scripts. Could someone explain to me how they work?

I found this on the internet:

Code:
The init command first stops all of the K symbolic links in the directory 
by issuing the /etc/rc.d/init.d/<command> stop command, where <command> 
is the process to be killed. It then starts all of the S symbolic links 
by issuing /etc/rc.d/init.d/<command> start.

After reading the above info I have this question:
Why would processes have to be killed if they have not been started in the first place?
# 4  
Old 12-14-2009
How should the system know in advance which services are running and which are not? Since it's possible to change runlevels in a running system (after all, that's what "shutdown" and "reboot" really do), and the services associated with each runlevel that would be quite non-trivial.
# 5  
Old 12-14-2009
Quote:
Originally Posted by mojoman
After reading the above info I have this question:
Why would processes have to be killed if they have not been started in the first place?
Because they will have been started at a different run level. When a run level is changed, processes that should not be running at that run level will have to be stopped.
# 6  
Old 12-14-2009
Another way to think of it is there is no harm in trying to kill something that may or may not be running.

It does point out a deficiency of init, though. A smarter "init" would know what is running and not waste time on unneeded kills.

Last edited by TonyLawrence; 12-14-2009 at 05:09 PM.. Reason: spelling
# 7  
Old 12-14-2009
Quote:
Originally Posted by TonyLawrence
Another way to think of it is there is no harm in trying to kill something that may or may not be running.

It does point out a deficiency of init, though. A smarter "init" would know what is running and not waste time on unneeded kills.
That's fair enough, but how smart would init have to be to see a K scripts and decide not to run it because it may not have started something like that earlier? Smilie

Last edited by Scott; 12-14-2009 at 05:22 PM..
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Help with creating startup scripts using screen

Edit: So sorry! I really didn't do a good job of clearly stating what I needed. Going to completely rewrite my post so everything is clearly stated. I'm having trouble writing a shell startup script for a linux server. It uses the bash shell if I remember correctly. I'm trying to write it so... (9 Replies)
Discussion started by: Pyitoechito
9 Replies

2. Solaris

Solaris 10 startup scripts

Hi all, I have a server in maintenance mode and need to boot it up. Its due to a broken service "RepX". I need to stop the service from trying to start at boot up but i can't find where it is booting up from... it is not in any of the rcX.d directories and the two locations i have found it... (6 Replies)
Discussion started by: Tommyk
6 Replies

3. UNIX for Advanced & Expert Users

xsession startup scripts

Can someone please tell me how to run xsession startup scripts whenever I start or after I restart my X session? I'm not trying to do anything fancy I just want this to run. This makes life a lot easier when I use a dual monitor. xrandr --output VGA1 --mode 1024x768 --rate 60 (7 Replies)
Discussion started by: cokedude
7 Replies

4. AIX

Startup/shutdown scripts in AIX

hi, If we place Sxx (startup script) and Kxx(shutdown script) in /etc/rc.d/rc2.d,then it would start and stop automatically(assume they are linked to other script that actually starts/stops). is there really a link needed here to /etc/rc.d/init.d? if not,what is the use of this directory..?... (1 Reply)
Discussion started by: to_bsr
1 Replies

5. AIX

Startup rc scripts log

Hi, I am trying to start services on system reboot on AIX. Have put the S* links under rd2.d & K* links under other rc*.d At the moment, all scripts are getting called. However, the services aren't coming up. Where can i find the logs for these to check what failed. (8 Replies)
Discussion started by: vibhor_agarwali
8 Replies

6. HP-UX

Startup scripts

Hi all We have HP UX 11.23 installed on 4 RISC servers (2 oracle databases, 2 Oracle App Servers) , we are in a construction period , so the power failure may happen more than once a day. I need to learn how to create an automatic startup services as in Windows, if we know that the services... (5 Replies)
Discussion started by: kafaween
5 Replies

7. Linux

startup scripts (rc3.d)

I've created the following link in order to startup apache tomcat on startup, however, it does not seem to run. Am I missing something out? :confused: /etc/init.d lrwxrwxrwx 1 root root 16 Sep 5 14:59 K73ypbind -> ../init.d/ypbind lrwxrwxrwx 1 root root 16 Sep 11 13:09 S100tomcat ->... (5 Replies)
Discussion started by: jon80
5 Replies

8. UNIX for Advanced & Expert Users

How to solve screwing startup scripts

Hello! unix os is OSF1 CP1 V4.0 878 alpha.It startup os normally.But when i use a command to run application, it restart within 10 sec.I have no spare harddisk& application to reinstall.When i asked this problem at this forum, it replys that start up scripts are screwed and to mount each... (12 Replies)
Discussion started by: akzin
12 Replies

9. Shell Programming and Scripting

startup scripts, how do they work in UNIX?

I need to make a script to start the postfix service on a server when the machine starts up. I have a script written below, which I think will work, but I am confused on how the rc2.d & rc3.d etc directories actually work. If I enter the script below, and stick it in the rc3.d directory,... (1 Reply)
Discussion started by: BG_JrAdmin
1 Replies

10. AIX

Startup/Shutdown scripts

I understand that by putting in entries into the /etc/inittab file. We can actually call the our scripts during startup. mkitab "start_server:2:once:sh /scripts/startserver.sh" Would the system wait for startserver.sh finish executing before it goes to another entry? and how long would it... (1 Reply)
Discussion started by: vincente
1 Replies
Login or Register to Ask a Question