Forum Moderators: bakedjake
sh: line 1: /etc/rc.d/init.d/sendmail: No such file or directory
Apparently the init.d file does not exist. Can anyone tell me how to write, or otherwise obtain this file, so I can start Sendmail on my server? Thanks!
#!/bin/sh
# Start/stop/restart sendmail.# Start sendmail:
sendmail_start() {
if [ -x /usr/sbin/sendmail ]; then
echo "Starting sendmail MTA daemon: /usr/sbin/sendmail -L sm-mta -bd -q25m"
/usr/sbin/sendmail -L sm-mta -bd -q25m
echo "Starting sendmail MSP queue runner: /usr/sbin/sendmail -L sm-msp-queue -Ac -q25m"
/usr/sbin/sendmail -L sm-msp-queue -Ac -q25m
fi
}# Stop sendmail:
sendmail_stop() {
killall sendmail
}# Restart sendmail:
sendmail_restart() {
sendmail_stop
sleep 1
sendmail_start
}case "$1" in
'start')
sendmail_start
;;
'stop')
sendmail_stop
;;
'restart')
sendmail_restart
;;
*)
echo "usage $0 start¦stop¦restart"
esac
(As always, if you use it make sure you change the broken pipe ¦ to a solid one from your keyboard.)
Couldn't you just call sendmail directly from the command line though?
But first, check to see if you have /etc/xinetd.d/sendmail. I had an FC1 VPS installation that did it that way; it wasn't constantly running, but only on demand.
#!/bin/bash
#
# sendmail This shell script takes care of starting and stopping
# sendmail.
#
# chkconfig: 2345 80 30
# description: Sendmail is a Mail Transport Agent, which is the program \
# that moves mail from one machine to another.
# processname: sendmail
# config: /etc/mail/sendmail.cf
# pidfile: /var/run/sendmail.pid# Source function library.
. /etc/rc.d/init.d/functions# Source networking configuration.
[ -f /etc/sysconfig/network ] && . /etc/sysconfig/network# Source sendmail configureation.
if [ -f /etc/sysconfig/sendmail ] ; then
. /etc/sysconfig/sendmail
else
DAEMON=no
QUEUE=1h
fi
[ -z "$SMQUEUE" ] && SMQUEUE="$QUEUE"
[ -z "$SMQUEUE" ] && SMQUEUE=1h# Check that networking is up.
[ "${NETWORKING}" = "no" ] && exit 0[ -f /usr/sbin/sendmail ] ¦¦ exit 0
RETVAL=0
prog="sendmail"start() {
# Start daemons.echo -n $"Starting $prog: "
if test -x /usr/bin/make -a -f /etc/mail/Makefile ; then
make all -C /etc/mail -s
else
for i in virtusertable access domaintable mailertable ; do
if [ -f /etc/mail/$i ] ; then
makemap hash /etc/mail/$i < /etc/mail/$i
fi
done
fi
/usr/bin/newaliases > /dev/null 2>&1
daemon /usr/sbin/sendmail $([ "x$DAEMON" = xyes ] && echo -bd) \
$([ -n "$QUEUE" ] && echo -q$QUEUE) $SENDMAIL_OPTARG
RETVAL=$?
echo
[ $RETVAL -eq 0 ] && touch /var/lock/subsys/sendmailif! test -f /var/run/sm-client.pid ; then
echo -n $"Starting sm-client: "
touch /var/run/sm-client.pid
chown smmsp:smmsp /var/run/sm-client.pid
daemon --check sm-client /usr/sbin/sendmail -L sm-msp-queue -Ac \
-q $SMQUEUE $SENDMAIL_OPTARG
RETVAL=$?
echo
[ $RETVAL -eq 0 ] && touch /var/lock/subsys/sm-client
fireturn $RETVAL
}stop() {
# Stop daemons.
echo -n $"Shutting down $prog: "
killproc sendmail
RETVAL=$?
echo
[ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/sendmail
if test -f /var/run/sm-client.pid ; then
echo -n $"Shutting down sm-client: "
killproc sm-client
RETVAL=$?
echo
[ $RETVAL -eq 0 ] && rm -f /var/run/sm-client.pid
[ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/sm-client
fi
return $RETVAL
}# See how we were called.
case "$1" in
start)
start
;;
stop)
stop
;;
restart¦reload)
stop
start
RETVAL=$?
;;
condrestart)
if [ -f /var/lock/subsys/sendmail ]; then
stop
start
RETVAL=$?
fi
;;
status)
status sendmail
RETVAL=$?
;;
*)
echo $"Usage: $0 {start¦stop¦restart¦condrestart¦status}"
exit 1
esacexit $RETVAL
Webmin simply did not find the init script where it expected to find it.
Your error message "
/etc/rc.d/init.d/sendmail: No such file or directory" only means that there was no "sendmail" init file in the "/etc/rc.d/init.d directory. While it is possible that there is no init.d directory, it's not likely. If your sendmail installation is set to be run under the xinetd process, then there will be a file in "
/etc/xinetd.d" called "sendmail". It's the same under init.d. While you can both start sendmail manually and get it to run at boot time (see above) under init.d, xinetd.d would not allow you to start it manually. The text file in /etc/xinetd.d reads either "disable=no" (good to go) or "disable=yes" (don't run it). If the init file is in xinetd.d, change "disable=yes" to "disable=no" and send HUP to the xinetd process to reload all of the init files in the xinetd.d directory. On both my RH7.2 and FC1 servers, sendmail's init file is in the init.d directory. Here's what it looks like on the RH7.2 box:
#!/bin/bash # # sendmail This shell script takes care of starting and stopping # sendmail. # # chkconfig: 2345 80 30 # description: Sendmail is a Mail Transport Agent, which is the program \ # that moves mail from one machine to another. # processname: sendmail # config: /etc/sendmail.cf # pidfile: /var/run/sendmail.pid # Source function library. . /etc/rc.d/init.d/functions # Source networking configuration. . /etc/sysconfig/network # Source sendmail configureation. if [ -f /etc/sysconfig/sendmail ] ; then . /etc/sysconfig/sendmail else DAEMON=no QUEUE=1h fi # Check that networking is up. [ ${NETWORKING} = "no" ] && exit 0 [ -f /usr/sbin/sendmail ] ¦¦ exit 0 RETVAL=0 prog="sendmail" start() { # Start daemons. [/code]
[code] echo -n $"Starting $prog: " /usr/bin/newaliases > /dev/null 2>&1 if test -x /usr/bin/make -a -f /etc/mail/Makefile ; then make all -C /etc/mail -s else for i in virtusertable access domaintable mailertable ; do if [ -f /etc/mail/$i ] ; then makemap hash /etc/mail/$i < /etc/mail/$i fi done fi daemon /usr/sbin/sendmail $([ "$DAEMON" = yes ] && echo -bd) \ $([ -n "$QUEUE" ] && echo -q$QUEUE) RETVAL=$? echo [ $RETVAL -eq 0 ] && touch /var/lock/subsys/sendmail return $RETVAL } [/code]
[code]stop() { # Stop daemons. echo -n $"Shutting down $prog: " killproc sendmail RETVAL=$? echo [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/sendmail return $RETVAL } [/code]
[code]# See how we were called. case "$1" in start) start ;; stop) stop ;; restart¦reload) stop start RETVAL=$? ;; condrestart) if [ -f /var/lock/subsys/sendmail ]; then stop start RETVAL=$? fi ;; status) status sendmail RETVAL=$? ;; *) echo $"Usage: $0 {start¦stop¦restart¦condrestart¦status}" exit 1 esac exit $RETVAL