LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 04-13-2012, 02:12 PM   #1
plisken
Member
 
Registered: Dec 2001
Location: Scotland
Distribution: Slackware 9.1-15 RH 6.2/7, RHEL 6.5 SuSE 8.2/11.1, Debian 10.5
Posts: 516

Rep: Reputation: 32
Is everything with +x in /etc/rc.d run at boot time?


As per subject???

I always thought that to be the case but having a little doubt today.

In the past I've found myself adding "things" to /etc/rc.local when Im thinking, should I simply be adding executable scripts to the /etc/rc.d folder?

Thanks in advance...
 
Old 04-13-2012, 02:21 PM   #2
Alien Bob
Slackware Contributor
 
Registered: Sep 2005
Location: Eindhoven, The Netherlands
Distribution: Slackware
Posts: 8,559

Rep: Reputation: 8106Reputation: 8106Reputation: 8106Reputation: 8106Reputation: 8106Reputation: 8106Reputation: 8106Reputation: 8106Reputation: 8106Reputation: 8106Reputation: 8106
The answer is "no".

If you add a script yourself, either call it in rc.local or add SysV compatible symlinks in /etc/rc<runlevel>.d/

Eric
 
Old 04-13-2012, 02:25 PM   #3
MensaWater
LQ Guru
 
Registered: May 2005
Location: Atlanta Georgia USA
Distribution: Redhat (RHEL), CentOS, Fedora, CoreOS, Debian, FreeBSD, HP-UX, Solaris, SCO
Posts: 7,831
Blog Entries: 15

Rep: Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669
No /etc/rc.d does have SOME things that are run at boot but others depend on run level:

ls -l /etc/rc.d
total 112
drwxr-xr-x 2 root root 4096 Mar 14 12:38 init.d
-rwxr-xr-x 1 root root 2255 Nov 13 2008 rc
drwxr-xr-x 2 root root 4096 Mar 14 12:39 rc0.d
drwxr-xr-x 2 root root 4096 Mar 14 12:39 rc1.d
drwxr-xr-x 2 root root 4096 Mar 14 12:39 rc2.d
drwxr-xr-x 2 root root 4096 Mar 14 12:39 rc3.d
drwxr-xr-x 2 root root 4096 Mar 14 12:39 rc4.d
drwxr-xr-x 2 root root 4096 Mar 14 12:39 rc5.d
drwxr-xr-x 2 root root 4096 Mar 14 12:39 rc6.d
-rwxr-xr-x 1 root root 220 Nov 13 2008 rc.local
-rwxr-xr-x 1 root root 27420 Mar 5 2009 rc.sysinit

init.d is a directory of init (boot) scripts but they aren't run from that directory directly.

The rc?.d directories are run level specific directories. The init scripts are linked into these directories and stopped/started when going into the specific run level. So if you went from Run level 2 to Run level 1 (single user) then the rc1.d links would get executed. If you booted your server and your default run level is 5 then it would start the links in /etc/rc5.d.

You can determine your current run level by typing "who -r". You can see what your default run level is by typing "grep initdefault /etc/fstab" which should show something like:
# 0 - halt (Do NOT set initdefault to this)
# 6 - reboot (Do NOT set initdefault to this)
id:5:initdefault:
The last line shows you default run level is 5. It might be different on your system. (5 is typically used for systems on which X windows is started automatically.)
 
Old 04-13-2012, 02:49 PM   #4
plisken
Member
 
Registered: Dec 2001
Location: Scotland
Distribution: Slackware 9.1-15 RH 6.2/7, RHEL 6.5 SuSE 8.2/11.1, Debian 10.5
Posts: 516

Original Poster
Rep: Reputation: 32
I may have been getting confused by lines like this from /etc/rc.d/rc.M
(Meaning if I make an /etc/rc.d/rc.* file not executable, then it wouldnt start)

# Start the MySQL database:
if [ -x /etc/rc.d/rc.mysqld ]; then
. /etc/rc.d/rc.mysqld start
fi

# Start Web server:
if [ -x /etc/rc.d/rc.httpd ]; then
. /etc/rc.d/rc.httpd start
fi

Thanks...
 
Old 04-13-2012, 09:08 PM   #5
TommyC7
Member
 
Registered: Mar 2012
Distribution: Slackware, CentOS, OpenBSD, FreeBSD
Posts: 530

Rep: Reputation: Disabled
In addition to the fact that it wouldn't start, it may not even be in /etc/rc.d/{rc.M,rc.S} or /etc/inetd.conf.

I do recommend commenting them out (I've heard it improves boot up time). That way instead of checking to see if the rc.* is executable, and then attempting to execute a non-executable file, commenting out the part of the respective script that starts the rc.* file will just skip that part entirely.
 
Old 04-14-2012, 09:44 AM   #6
th0gz19
LQ Newbie
 
Registered: Dec 2011
Location: Philippines
Distribution: Slackware, Debian, Gentoo
Posts: 10

Rep: Reputation: Disabled
TommyC7 is right.

instead of removing the executable bit of a script, comment it out in your rc.M file if you don't need the script to run at all,
this way you don't have to change the executable bit. then when the time comes you need the script to run, we can do

# /etc/rc.d/rc.<scriptname> start

without adding the executable bit again everytime you want to run the script
 
Old 04-14-2012, 09:56 AM   #7
BCarey
Senior Member
 
Registered: Oct 2005
Location: New Mexico
Distribution: Slackware
Posts: 1,639

Rep: Reputation: Disabled
Quote:
Originally Posted by th0gz19 View Post
TommyC7 is right.

instead of removing the executable bit of a script, comment it out in your rc.M file if you don't need the script to run at all,
this way you don't have to change the executable bit. then when the time comes you need the script to run, we can do

# /etc/rc.d/rc.<scriptname> start

without adding the executable bit again everytime you want to run the script
You do not need to make the script executable to run it if you invoke it like

# sh /etc/rc.d/rc.<scriptname> start

The disadvantage of the "commenting out" approach is that system maintenance with regard to updates and upgrades requires additional diligence. I would be interested to see if there is really a noticeable difference in speed. Unlike what TommyC7 wrote, if the executable bit is not set then it does not try to run the file.

Brian
 
Old 04-14-2012, 10:33 AM   #8
Erik_FL
Member
 
Registered: Sep 2005
Location: Boynton Beach, FL
Distribution: Slackware
Posts: 821

Rep: Reputation: 258Reputation: 258Reputation: 258
Quote:
Originally Posted by MensaWater View Post
You can see what your default run level is by typing "grep initdefault /etc/fstab" which should show something like:
# 0 - halt (Do NOT set initdefault to this)
# 6 - reboot (Do NOT set initdefault to this)
id:5:initdefault:
The last line shows you default run level is 5.
I think perhaps that you meant "/etc/inittab" rather than "/etc/fstab".

Code:
grep initdefault /etc/inittab
In any case, thanks for mentioning "who -r". I was not aware of that command.
 
Old 04-16-2012, 08:41 AM   #9
MensaWater
LQ Guru
 
Registered: May 2005
Location: Atlanta Georgia USA
Distribution: Redhat (RHEL), CentOS, Fedora, CoreOS, Debian, FreeBSD, HP-UX, Solaris, SCO
Posts: 7,831
Blog Entries: 15

Rep: Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669
Yep inittab not fstab.

Funny thing is when I checked it I made the same mistake and meant to update my post accordingly but forgot to do so. D'oh!
 
  


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



Similar Threads
Thread Thread Starter Forum Replies Last Post
How to run a program at boot time crazylegs SUSE / openSUSE 2 12-12-2007 09:08 PM
Is a script, run at boot time from init.d, run with root authority? tmbrwolf53 Linux - Server 2 03-31-2007 08:15 PM
Adding programs to run during boot time JonnyW247 Linux - Software 1 02-05-2006 03:52 PM
i want to run a script or program at boot time!! FreakboY Linux - Newbie 9 10-12-2003 08:03 AM
Sound : run artswrapper at boot-time mimil Linux - Hardware 3 08-04-2003 05:05 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 12:15 AM.

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