LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 04-11-2012, 12:51 PM   #1
tonj
Member
 
Registered: Sep 2008
Posts: 497

Rep: Reputation: 37
centos 6 server: where is startup shell?


centos 6.2 server install

I'm trying to install mimedefang-2.73.tar.gz and in the instructions it says I have to find the shell startup script that starts sendmail, and edit it so mimedefang starts just before it. Sendmail already starts at boot and has done so ever since I first installed centos server.
Problem is I don't know where this script is. I went into /etc/rc.d/init.d and saw several files there (rc0.d, rc1.d, rc2.d etc), most of which contains stuff on the startup of sendmail.
where is the shell script that starts sendmail at bootup?
 
Old 04-11-2012, 01:01 PM   #2
MensaWater
LQ Guru
 
Registered: May 2005
Location: Atlanta Georgia USA
Distribution: Redhat (RHEL), CentOS, Fedora, CoreOS, Debian, FreeBSD, HP-UX, Solaris, SCO
Posts: 7,517
Blog Entries: 15

Rep: Reputation: 1470Reputation: 1470Reputation: 1470Reputation: 1470Reputation: 1470Reputation: 1470Reputation: 1470Reputation: 1470Reputation: 1470Reputation: 1470
In /etc/init.d you'll find the startup script for sendmail.

In /etc/rc?.d are links back to the startup script. rc1.d = run level 1, rc2.d = run level 2 etc... - The run level determines which scripts will be started. If you type "who -r" you'll see which run level you're in.

It appears they're asking you to modify /etc/init.d/sendmail. Be sure to save a copy before you do so you can back out if necessary.
cd /etc/init.d
cp -p sendmail sendmail.20120411

Another option would be to write a separate init script for mimedefang and start it before the sendmail script. The number on the files in /etc/rc?.d determines order. (e.g. S10<file> would start before S11<file>.) Writing your own startup script is a bit tricky so you'd have to search for information on doing that if you want to go that route.
 
Old 04-11-2012, 01:01 PM   #3
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1977Reputation: 1977Reputation: 1977Reputation: 1977Reputation: 1977Reputation: 1977Reputation: 1977Reputation: 1977Reputation: 1977Reputation: 1977Reputation: 1977
the main script is /etc/init.d/sendmail. the rcX.d directories just contain symlinks to that script. starting before sendmail means that the links to the relevant rcX.d directory should have an "S##" number lower than that of the sendmail one.
 
Old 04-11-2012, 02:15 PM   #4
tonj
Member
 
Registered: Sep 2008
Posts: 497

Original Poster
Rep: Reputation: 37
I know about the script that starts sendmail at /etc/rc.d/init.d/ but it's the one that starts sendmail at BOOTUP that I need to edit. I need to start mimedefang before sendmail during BOOTUP of the server. I know what I need to type but I don't know where the script is that needs to be edited.
 
Old 04-11-2012, 02:54 PM   #5
MensaWater
LQ Guru
 
Registered: May 2005
Location: Atlanta Georgia USA
Distribution: Redhat (RHEL), CentOS, Fedora, CoreOS, Debian, FreeBSD, HP-UX, Solaris, SCO
Posts: 7,517
Blog Entries: 15

Rep: Reputation: 1470Reputation: 1470Reputation: 1470Reputation: 1470Reputation: 1470Reputation: 1470Reputation: 1470Reputation: 1470Reputation: 1470Reputation: 1470
You don't "know" what you think you "know" based on your response. I'd suggest you reread the responses. They both tell you the correct answer.

When asking for help if you think an answer is unclear it is better to ask for clarification than to assume the replies were made by morons.
 
Old 04-11-2012, 03:55 PM   #6
tonj
Member
 
Registered: Sep 2008
Posts: 497

Original Poster
Rep: Reputation: 37
you have misunderstood my response and taken offence. I need to start mimedefang before sendmail during bootup of the server. The instructions from mimedefang say this:
'Ensure that mimedefang starts when Sendmail does. In whatever shell script
starts sendmail at boot time, add the lines:
rm -f /var/spool/MIMEDefang/mimedefang.sock
/usr/local/bin/mimedefang -p /var/spool/MIMEDefang/mimedefang.sock &
before the line which actually starts Sendmail.'

'In whatever shell script starts sendmail at boot time' - this is where I'm stuck.
 
Old 04-11-2012, 04:01 PM   #7
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1977Reputation: 1977Reputation: 1977Reputation: 1977Reputation: 1977Reputation: 1977Reputation: 1977Reputation: 1977Reputation: 1977Reputation: 1977Reputation: 1977
You're stuck as you're still not paying any attention the the replies you had. if you did, you wouldn't be stuck.
 
Old 04-11-2012, 05:03 PM   #8
MensaWater
LQ Guru
 
Registered: May 2005
Location: Atlanta Georgia USA
Distribution: Redhat (RHEL), CentOS, Fedora, CoreOS, Debian, FreeBSD, HP-UX, Solaris, SCO
Posts: 7,517
Blog Entries: 15

Rep: Reputation: 1470Reputation: 1470Reputation: 1470Reputation: 1470Reputation: 1470Reputation: 1470Reputation: 1470Reputation: 1470Reputation: 1470Reputation: 1470
To make it painfully clear:

On CentO6/RHEL:
/etc/init.d is a symbolic link to /etc/rc.d/init.d which means when I speak of the former and you speak of the latter we're talking about the SAME directory.

When I say /etc/rc?.d I am using the question mark as a standard meta character that matches ANY single character so I'm talking about multiple directories. If you run "ls -ld /etc/rc?.d" you'll see multiple directories:
ls -ld /etc/rc?.d
lrwxrwxrwx. 1 root root 10 Mar 9 2011 /etc/rc0.d -> rc.d/rc0.d
lrwxrwxrwx. 1 root root 10 Mar 9 2011 /etc/rc1.d -> rc.d/rc1.d
lrwxrwxrwx. 1 root root 10 Mar 9 2011 /etc/rc2.d -> rc.d/rc2.d
lrwxrwxrwx. 1 root root 10 Mar 9 2011 /etc/rc3.d -> rc.d/rc3.d
lrwxrwxrwx. 1 root root 10 Mar 9 2011 /etc/rc4.d -> rc.d/rc4.d
lrwxrwxrwx. 1 root root 10 Mar 9 2011 /etc/rc5.d -> rc.d/rc5.d
lrwxrwxrwx. 1 root root 10 Mar 9 2011 /etc/rc6.d -> rc.d/rc6.d

You'll also see that those just like init.d are actually symbolic links to /etc/rc.d/rc?.d directories.

The BOOTUP script you're looking for is in ONE of the rc?.d directories and which ONE depends on which run level you start in as I explained in my first post.

So for example on one of my systems if I run: who -r
It returns: run-level 5 2012-01-11 18:28
That means the important directory for that system is /etc/rc5.d (which is a link to /etc/rc.d/rc5.d). If I look in that directory for something with sendmail in the name with "ls -l /etc/rc5.d/*sendmail*" it shows me:
lrwxrwxrwx 1 root root 18 Apr 8 2011 /etc/rc5.d/S80sendmail -> ../init.d/sendmail
Which means that the S80 start script is a symbolic link to the script in /etc/init.d called simply sendmail.

If you look in other /etc/rc?.d directories you may also see links to that same /etc/init.d/sendmail. The design of init scripts is that you do NOT edit in each run level but instead edit in /etc/init.d and then link from the run level to the /etc/init.d based script if you want to use that script in that runlevel.

This means they are asking you to edit /etc/init.d/sendmail.
 
Old 04-12-2012, 03:48 AM   #9
tonj
Member
 
Registered: Sep 2008
Posts: 497

Original Poster
Rep: Reputation: 37
if I do who -r I get 'run-level 3 2012-04-11 17:44'.
and then if I do 'ls -l /etc/rc3.d/*sendmail' I get:
lrwxrwxrwx. 1 root root 18 Mar 24 19:43 /etc/rc3.d/S80sendmail -> ../init.d/sendmail
so I see I'm run level 3. I understand it up until you say 'you do NOT edit in each run level but instead edit in /etc/init.d and then link from the run level to the /etc/init.d based script if you want to use that script in that runlevel.' This is really confusing.
I read elsewhere one should not edit the sendmail script itself because it will only get wiped when an update replaces it. I've been searching google for hours but I can't find a straightfoward example of what I need to do.
 
Old 04-12-2012, 04:06 AM   #10
tonj
Member
 
Registered: Sep 2008
Posts: 497

Original Poster
Rep: Reputation: 37
hang on... I think I did it.
I found this: http://www.mickeyhill.com/mimedefang-howto/ and edited /etc/init.d/sendmail as per the example given. And now when I boot the server the scroll shows mimedefang starts just before sendmail, and if I do a sendmail restart I get:
Shutting down sm-client: [ OK ]
Shutting down sendmail: [ OK ]
Shutting down mimedefang: [ OK ]
Shutting down mimedefang-multiplexor: [ OK ]
Starting mimedefang-multiplexor: [ OK ]
Starting mimedefang: [ OK ]
Starting sendmail: [ OK ]
Starting sm-client: [ OK ]
so I think this is correct....
 
1 members found this post helpful.
Old 04-12-2012, 08:52 AM   #11
MensaWater
LQ Guru
 
Registered: May 2005
Location: Atlanta Georgia USA
Distribution: Redhat (RHEL), CentOS, Fedora, CoreOS, Debian, FreeBSD, HP-UX, Solaris, SCO
Posts: 7,517
Blog Entries: 15

Rep: Reputation: 1470Reputation: 1470Reputation: 1470Reputation: 1470Reputation: 1470Reputation: 1470Reputation: 1470Reputation: 1470Reputation: 1470Reputation: 1470
Yes.

I was saying you edit the script in /etc/init.d and the link from /etc/rc3.d will use that edit.

When I said "you then do link" I was talking about when you were adding a new init script to go over the concept of init scripts and not saying you needed to add a link for sendmail as that link was already there.
 
Old 04-12-2012, 08:35 PM   #12
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.10, Centos 7.5
Posts: 17,565

Rep: Reputation: 2425Reputation: 2425Reputation: 2425Reputation: 2425Reputation: 2425Reputation: 2425Reputation: 2425Reputation: 2425Reputation: 2425Reputation: 2425Reputation: 2425
Now take a copy of the new sendmail startup script, because (as above) it may get updated during a system update.
 
  


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
Mysql startup error on Centos 5.2 custangro Linux - Server 4 09-16-2009 06:23 PM
in bash shell how to run shell script during startup rammohan04 Red Hat 2 07-31-2009 03:07 AM
Problem updating a shell startup file in SUSE Server 10 Sergei Z Linux - Newbie 4 06-03-2007 11:18 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

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