Linux - SoftwareThis 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
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
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?
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.
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.
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.
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.
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.
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.
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....
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.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.