• If you are still using CentOS 7.9, it's time to convert to Alma 8 with the free centos2alma tool by Plesk or Plesk Migrator. Please let us know your experiences or concerns in this thread:
    CentOS2Alma discussion

qmail smtp error

R

r4fromuk

Guest
Hi all,

I have fc4 with plesk 8.2.1 fresh install. Everything seems to work expect for the smtp server.

In the panel the SMTP is not running and restarting it does nothing. If i login to ssh and try /etc/init.d/qmail start if get the following error:

/etc/init.d/qmail: line 25: [: =: unary operator expected
Starting qmail: [ OK ]

but qmail does not start. Im stuck with this and need help.

Thanks.
 
Update: I can now receive emails but cannot connect to mail server even from the box telnet 127.0.0.1 25

:(
 
Show your /etc/init.d/qmail and

Code:
netstat -lnp | grep 25

Does your firewall block the smtp 25 port?

What do you get when you trying to connect to localhost on port 25 from telnet ?
 
Hi thanks,

Firewall disabled, no difference. Looking at qmail it's all running but still no emails.

netstat -lnp | grep 25 << shows nothing.

/etc/init.d/qmail
Code:
#! /bin/sh
#
# This is /etc/rc.d/init.d file for Q-Mail
#
# chkconfig: 345 80 30
# description: qmail Mail Transfer Agent
# processname: qmail-send
#
#
### BEGIN INIT INFO
# Provides:       sendmail qmail
# Required-Start: $network $named $syslog $remote_fs $time
# X-UnitedLinux-Should-Start:
# Required-Stop:
# Default-Start:  3 5
# Default-Stop:
# Description:    start the qmail MTA
### END INIT INFO

# Source networking configuration.
if [ -f /etc/sysconfig/network ]; then
	. /etc/sysconfig/network

	# Check that networking is up.
	[ ${NETWORKING} = "no" ] && exit 0
fi

# Source function library.
if [ -f /etc/init.d/functions ]; then
	. /etc/init.d/functions
fi

# this way is for SuSE Linux
test -s /etc/rc.status && . /etc/rc.status && rc_reset

if ! type status >/dev/null 2>/dev/null; then
    status () {
	pidof >/dev/null qmail-send
    }
fi

# pidofproc does not exist on Debian linux
if ! type pidofproc >/dev/null 2>/dev/null; then

	# A function to find the pid of a program.
	pidofproc() {
		base=${1##*/}

		# Test syntax.
		if [ "$#" = 0 ]; then
			echo $"Usage: pidofproc {program}"
			return 1
		fi

		# First try "/var/run/*.pid" files
		if [ -f /var/run/$base.pid ]; then
		        local line p pid=
			read line < /var/run/$base.pid
			for p in $line ; do
			       [ -z "echo $p | tr -d '[0-9]'" -a -d /proc/$p ] && pid="$pid $p"
			done
		        if [ -n "$pid" ]; then
		                echo $pid
	                return 0
		        fi
		fi
		pidof -o $$ -o $PPID -o %PPID -x $1 || \
			pidof -o $$ -o $PPID -o %PPID -x $base
	}

fi

myname=qmail
qmail_dir=/var/qmail
subsys=/var/lock/subsys/$myname
PATH="$qmail_dir/bin:$PATH" 
export PATH
proccess=qmail-send

# this function is designed to emulate RedHat-like service reporting on the SuSE Linux
report_action()
{
	# $1 - text to put
	# $2 - status of operation
	case `type -t action` in
		function)
			# red hat operation reporting style
			action $"$1" $2
			;;
		*)
			case `type -t rc_reset` in
				function)
					# suse linux reporting style
					rc_reset
					echo -n $"$1"
					$2
					rc_status -v
					;;
				*)
					# debian style, probably useful for other systems
					echo -n $"$1"
					$2
					if [ $? -eq 0 ]; then
						echo "done"
					else
						echo "failed"
					fi
					;;
			esac
			;;
	esac
}

start() 
{
		if [ -x /sbin/start-stop-daemon -a ! -d "`dirname $subsys`" ]; then
			# use debian daemon control facility
			sh -c "start-stop-daemon --start --quiet --user qmails \
				--exec ${qmail_dir}/bin/qmail-send \
				--startas ${qmail_dir}/bin/qmail-start -- ./Maildir/ splogger qmail 2 &"
		else
			qmail-start ./Maildir/ splogger qmail &
		fi

		sleep 1
		pidofproc $proccess >/dev/null 2>&1
        	ret=$?
        	if [ "$ret" -eq 0 ]; then
        	    report_action "Starting $myname: " /bin/true
        	else
        	    report_action "Starting $myname: " /bin/false
        	fi
        	[ "$ret" -eq 0 ] && [ -d "`dirname $subsys`" ] && touch $subsys
        	return "$ret"
}

check_and_start()
{
	if [ ! -f $subsys ]; then
		start
	fi
}
	
stop()
{
	if [ -f $subsys ]; then
		echo -n $"Stopping $prog: " 
		killproc $proccess > /dev/null 2>&1
	else
		if [ -x /sbin/start-stop-daemon -a ! -d "`dirname $subsys`" ]; then
			# use debian daemon control facility
			start-stop-daemon --user qmails --stop --quiet --oknodo --exec ${qmail_dir}/bin/qmail-send
		else
			killall $proccess  >/dev/null 2>&1
		fi
	fi

	[ -f "$subsys" ] && rm -f "$subsys"
	for i in 1 1 1 1 1 5 10 10 10 10 10; do
		pidofproc $proccess >/dev/null 2>&1
		[ 0 -ne "$?" ] && return 0
		sleep $i
	done

	for i in qmail-remote.moved qmail-send; do
		killall $i
		sleep 1
		killall -9 $i
		sleep 1
	done >/dev/null 2>&1 

	pidofproc $proccess >/dev/null 2>&1
	return $?
}

restart(){
    stop
    start
}

condrestart(){
    [ -e $subsys ] && restart || true
}

#reload(){
#    [ -e /var/lock/subsys/$myname ] && mysqladmin reload
#}
	
# See how we were called.
case "$1" in
  start)
    start
    ;;
  condstart)
    check_and_start
    ;;
  stop)
    stop
    ;;
  status)
    status $proccess
    ;;
  reload)
    restart
#    reload
    ;;
  restart)
    restart
    ;;
  condrestart)
    condrestart
    ;;
  force-reload)
  	restart
	;;
  *)
    echo $"Usage: $0 {start|stop|status|reload|condrestart|restart}"
    exit 1
esac

exit $?
 
I think the issue might be that xinetd will not start
Code:
[root@web ~]# /etc/init.d/xinetd start
[root@web ~]# /etc/init.d/xinetd status
 
Line 25 is a check of the variable
"NETWORKING". For me this looks like a problem that /etc/sysconfig/network is not setting that to "yes".
If /etc/init.d/qmail sees that /etc/sysconfig/network is a file, it will try to execute it and check the var NETWORKING right after.

Try to set that variable temporarily:

OLDNETW=$NETWORKING && NETWORKING="yes" && /etc/init.d/qmail start && NETWORKING=$OLDNETW

btw. in my system /etc/sysconfig/network is a directory, not a script. :confused:

I've checked one of my FC-Systems and found out that on it /etc/sysconfig/network really is a file. That looks like a compatibility-prob of Plesk on FC.
 
Look at this ;)

#cat /etc/sysconfig/network
NETWORKING=yes
HOSTNAME=plesk-expand

Maybe its "no" in your file?
 
Back
Top