LinuxQuestions.org
View the Most Wanted LQ Wiki articles.
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 12-30-2003, 04:11 PM   #1
Blu-star
Member
 
Registered: Sep 2003
Posts: 35

Rep: Reputation: 15
the proper way to shutdown services.


hey!

what is the proper way to make programs not to start at systemstartup.
when i first installed slackware and ran ps -aux i saw that there was a few things i didnīt want running, one was sendmail and the other OpenSSH.

i went to /etc/rc.d and i saw there was a file called rc.sendmail there, i did a chmod ugo-rwx on that file, and after that it hasnīt started, is this the real way to do this? if not, how should i do?

the OpenSSHd i commented out from rc.inet2 (i think it was inet2).

help out a newbie please
 
Old 12-30-2003, 04:31 PM   #2
MartinN
Member
 
Registered: Nov 2003
Location: Ronneby, Sweden
Posts: 555

Rep: Reputation: 30
No, that's not the right way. First find out what runlevel you are in. As root, type
runlevel
It's probably 2 or 3 if you have text login or 5 if you are using graphical login.

Now, go to the directory /etc/rc.d/rcN.d where N=your runlevel. This directory contains a lot of symbolic links to the directory ../init.d/

Remove the links to the services you are not using.

Regards
Martin
 
Old 12-30-2003, 05:40 PM   #3
mr_manny
Member
 
Registered: Sep 2003
Distribution: RH7.3, RH9 w/fluxbox best thing since sliced bread
Posts: 34

Rep: Reputation: 15
here is another way....
[root@myBOX manny]# /sbin/runlevel
N 3

Redhat
To display what is configured for a particular runlevel, try the following:
[root@myBOX manny]# /sbin/chkconfig --list | grep 3:on
keytable 0:off 1:on 2:on 3:on 4:on 5:on 6:off
atd 0:off 1:off 2:off 3:on 4:on 5:on 6:off
syslog 0:off 1:off 2:on 3:on 4:on 5:on 6:off
gpm 0:off 1:off 2:on 3:on 4:on 5:on 6:off
kudzu 0:off 1:off 2:off 3:on 4:on 5:on 6:off
vmware 0:off 1:off 2:on 3:on 4:off 5:on 6:off
sshd 0:off 1:off 2:on 3:on 4:on 5:on 6:off
network 0:off 1:off 2:on 3:on 4:on 5:on 6:off
random 0:off 1:off 2:on 3:on 4:on 5:on 6:off
ipchains 0:off 1:off 2:on 3:on 4:on 5:on 6:off
iptables 0:off 1:off 2:on 3:on 4:on 5:on 6:off
crond 0:off 1:off 2:on 3:on 4:on 5:on 6:off
anacron 0:off 1:off 2:on 3:on 4:on 5:on 6:off
lpd 0:off 1:off 2:on 3:on 4:on 5:on 6:off
portmap 0:off 1:off 2:off 3:on 4:on 5:on 6:off
xfs 0:off 1:off 2:on 3:on 4:on 5:on 6:off
xinetd 0:off 1:off 2:on 3:on 4:on 5:on 6:off
[root@myBOX manny]#

to shutoff a particular service/deamon, try the following
[root@myBOX manny]# /sbin/chkconfig sshd off

you will notice that sshd is no longer configured to run:

[root@myBOX manny]# /sbin/chkconfig --list | grep 3:on
keytable 0:off 1:on 2:on 3:on 4:on 5:on 6:off
atd 0:off 1:off 2:off 3:on 4:on 5:on 6:off
syslog 0:off 1:off 2:on 3:on 4:on 5:on 6:off
gpm 0:off 1:off 2:on 3:on 4:on 5:on 6:off
kudzu 0:off 1:off 2:off 3:on 4:on 5:on 6:off
vmware 0:off 1:off 2:on 3:on 4:off 5:on 6:off
network 0:off 1:off 2:on 3:on 4:on 5:on 6:off
random 0:off 1:off 2:on 3:on 4:on 5:on 6:off
ipchains 0:off 1:off 2:on 3:on 4:on 5:on 6:off
iptables 0:off 1:off 2:on 3:on 4:on 5:on 6:off
crond 0:off 1:off 2:on 3:on 4:on 5:on 6:off
anacron 0:off 1:off 2:on 3:on 4:on 5:on 6:off
lpd 0:off 1:off 2:on 3:on 4:on 5:on 6:off
portmap 0:off 1:off 2:off 3:on 4:on 5:on 6:off
xfs 0:off 1:off 2:on 3:on 4:on 5:on 6:off
xinetd 0:off 1:off 2:on 3:on 4:on 5:on 6:off


to enable a service/deamon, it's the opposite:
[root@myBOX manny]# /sbin/chkconfig sshd on

hope this helps,
manny
 
Old 12-30-2003, 06:44 PM   #4
thegeekster
Member
 
Registered: Dec 2003
Location: USA (Pacific coast)
Distribution: Vector 5.8-SOHO, FreeBSD 6.2
Posts: 513

Rep: Reputation: 33
Re: the proper way to shutdown services.

Quote:
Originally posted by Blu-star
...i went to /etc/rc.d and i saw there was a file called rc.sendmail there, i did a chmod ugo-rwx on that file, and after that it hasnīt started, is this the real way to do this? if not, how should i do?...
Not quite. You only need to remove the executable bit (x) to stop a service from starting, not all the permissions. In the /etc/rc.d directory (in Slackware at least), list the directory with the -l option ( ls -l /etc/rc.d ). the default permissions for a service with the x permission removed would look like this:

-rw-r--r-- 1 root root

while the ones that do start at boot would look like this:

-rwx-r-xr-x 1 root root

What you're doing with that particular chmod command is locking all users out of those bootup scripts, including root, which will make it look like this (you won't even be able to open up the file to look at it):

---------- 1 root root

To restore any files you may have locked, you can run this command:

chmod a+r /etc/rc.d/* ; chmod u+w /etc/rc.d/*

None of the other files will be affected. Only the files with all permissions removed (the locked ones) will be restored without setting the x bit.


The correct command to stop a service starting at boot would be:

chmod a-x /etc/rc.d/<filename>

(Notice that you can use 'a' in the command instead of 'ugo' to accomplish the same thing)


NOTE: Using chmod will prevent/allow services starting during boot globally, ie., regardless of runlevel. If you only want to change it for a particular runlevel, then use the method outlined by MartinN. Only, I would just comment out the desired service (not remove it) in case you may change your mind in the future.
 
Old 12-31-2003, 09:14 AM   #5
Blu-star
Member
 
Registered: Sep 2003
Posts: 35

Original Poster
Rep: Reputation: 15
thanks for the help!

really appriciated.
 
Old 12-31-2003, 09:19 AM   #6
ugge
Senior Member
 
Registered: Dec 2000
Location: Gothenburg, SWEDEN
Distribution: OpenSUSE 10.3
Posts: 1,028

Rep: Reputation: 45
You might have the command ntsysv mhich will help you do this just by (un)checking services to start at current run level. These setting will kick in next boot, or when you change run level.
 
Old 12-31-2003, 06:18 PM   #7
thegeekster
Member
 
Registered: Dec 2003
Location: USA (Pacific coast)
Distribution: Vector 5.8-SOHO, FreeBSD 6.2
Posts: 513

Rep: Reputation: 33
Quote:
Originally posted by ugge
You might have the command ntsysv mhich will help you do this just by (un)checking services to start at current run level. These setting will kick in next boot, or when you change run level.
ntsysv is a RedHat specific util and might not work with Slack, which is what he said he installed in the very first post.............AFAIK, RH does things a little differently than Slack when it comes to booting up the services.

Last edited by thegeekster; 12-31-2003 at 06:20 PM.
 
Old 01-01-2004, 03:12 AM   #8
ugge
Senior Member
 
Registered: Dec 2000
Location: Gothenburg, SWEDEN
Distribution: OpenSUSE 10.3
Posts: 1,028

Rep: Reputation: 45
Thanx for the info
 
Old 01-01-2004, 12:57 PM   #9
detpenguin
Senior Member
 
Registered: Oct 2003
Location: lost in the midwest...
Distribution: Slackware
Posts: 1,091

Rep: Reputation: 45
is there a list of what each program does someplace? how would i know which programs i need running, and which are just there for convenience?
 
Old 01-01-2004, 07:21 PM   #10
thegeekster
Member
 
Registered: Dec 2003
Location: USA (Pacific coast)
Distribution: Vector 5.8-SOHO, FreeBSD 6.2
Posts: 513

Rep: Reputation: 33
Quote:
Originally posted by detpenguin
is there a list of what each program does someplace? how would i know which programs i need running, and which are just there for convenience?
I haven't come across anything, yet, that list basic startup daemons that would apply for all distros. Keep in mind that different systems may require a couple of different startup daemons for essential operation. Anyway, here's some links to look at:

Common Startup Services (Daemons) - Describes some of the different startup services, but seems to list some services specific to a RedHat-based distro not found on all distros.

Slackware.com - System Startup - Slackware startup is based on BSD startup and this shows some basic daemons. This might give you an idea of what may be essential.

Red HatŪ Linux 6 Unleashed: Chapter 6 - Describes the startup and shutdown of RH. The second section (different page) talks about the different scripts and daemons.

Linux Startup Manual - The name says it all. <EDIT> Describes the startup process of a System V compatible system. Many Linux distributions make use of this style, as opposed to a BSD style. The difference is in a System V compatible distro there is given a subdirectory for each runlevel, while BSD compatible systems give one startup script to each runlevel (not subdirectories). </EDIT>


HTH

Last edited by thegeekster; 01-01-2004 at 10:29 PM.
 
Old 01-01-2004, 09:15 PM   #11
detpenguin
Senior Member
 
Registered: Oct 2003
Location: lost in the midwest...
Distribution: Slackware
Posts: 1,091

Rep: Reputation: 45
excellent!!! thanks geekster!
 
  


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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Please help on how to save services shutdown or shutdown from the terminal. wambuzz Linux - General 2 03-11-2005 07:38 AM
killall X - this is not the proper shutdown mechanism, is it?? e-regular Linux - Newbie 4 09-10-2003 09:42 AM
How to shutdown External Services jack101 Linux - Newbie 8 08-15-2003 08:35 AM
Proper way to shutdown? snocked Linux - Newbie 12 02-11-2003 08:26 AM
Proper shutdown linuxRules Linux - General 6 05-24-2002 03:56 PM


All times are GMT -5. The time now is 01:50 PM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration