Replying to a message from: Eric Bruno

I have just installed Xemas using the QNAP package on the Xeams web site Version 7.0, build 6081

The package does not seem to restarting from the xmas server options menu option Restart Server, I have login via ssh to and run the xeams.sh script unless I reboot the qnap.

This command also fails. ./xeams.sh restart (see below for more info).

I have three domains that I am pulling email from using fetch mail

The the default spam filter is overly aggressive so over 95% of the mail is flagged as junk.

I white list the senders and then restore the emails, but nothing happens the emails do not seem to resubmitted.

What is the expected behavior? Am I doing this correctly?
Is there a configuration option I need to set?

The SMTP server is configured and listening on ports 25 and 587 (not the SMTP status display only shows listen on port 25 and not on port 587)
The POP3 status shows both non-secure and secure ports.

[/share/CACHEDEV1_DATA/.qpkg/Xeams] # netstat -ln | grep tcp | grep 25
tcp 0 0 0.0.0.0:25 0.0.0.0:* LISTEN
[/share/CACHEDEV1_DATA/.qpkg/Xeams] # netstat -ln | grep tcp | grep 587
tcp 0 0 0.0.0.0:587 0.0.0.0:* LISTEN

In xeams.sh the stop rule has a hardwire 2 second timer.  On my QNAP TVS-873 with 64 GB of memory the shutdown takes longer.

I modified the stop case to be as shown below:

/bin/echo -n "Attempting to stop Xeams Server: "
PID=`/bin/ps | /bin/grep -v grep | /bin/grep "Xeams" | awk '{print $1}'`
#echo $PID
if [ -z "$PID" ] ; then
   /bin/echo "Not running."
else
   /bin/kill ${PID}
  max_wait=60;
  count=0;
  while [ ${count} -lt ${max_wait} ]
  do
      /bin/sleep 1
      PID=`/bin/ps | /bin/grep -v grep | /bin/grep "Xeams" | awk '{print $1}'`
      if [ -n "${PID}" ]; then
         ((count++));
         continue;
     else
        break;
     fi;
  done;
  /bin/echo "Stopped after ${count} seconds."
fi

You can see from the commands listed below the shutdown down is much longer than 2 seconds.

[/share/CACHEDEV1_DATA/.qpkg/Xeams] # ./xeams.sh stop
Attempting to stop Xeams Server: Stopped after 7 seconds.
[/share/CACHEDEV1_DATA/.qpkg/Xeams] # ./xeams.sh start
JRE QPKG is installed and enabled.
Attempting to start Xeams Server: Started
[/share/CACHEDEV1_DATA/.qpkg/Xeams] # ./xeams.sh stop
Attempting to stop Xeams Server: Stopped after 5 seconds.

 

Now if I do restart it works from the command line, still does not restart from the web interface.

I also modified the start case to make sure the application actually is running, here is the entire modified script:

 

=============== xeams.sh New ==================

#!/bin/sh
CONF=/etc/config/qpkg.conf
QPKG_NAME="Xeams"
declare -i status=0;
PUBLIC_SHARE=`/sbin/getcfg SHARE_DEF defPublic -d Public -f /etc/config/def_share.info`

# Determine BASE installation location according to smb.conf
BASE=
publicdir=`/sbin/getcfg $PUBLIC_SHARE path -f /etc/config/smb.conf`
if [ ! -z $publicdir ] && [ -d $publicdir ];then
publicdirp1=`/bin/echo $publicdir | /bin/cut -d "/" -f 2`
publicdirp2=`/bin/echo $publicdir | /bin/cut -d "/" -f 3`
publicdirp3=`/bin/echo $publicdir | /bin/cut -d "/" -f 4`
if [ ! -z $publicdirp1 ] && [ ! -z $publicdirp2 ] && [ ! -z $publicdirp3 ]; then
[ -d "/${publicdirp1}/${publicdirp2}/${PUBLIC_SHARE}" ] && BASE="/${publicdirp1}/${publicdirp2}"
fi
fi

# Determine BASE installation location by checking where the Public folder is.
if [ -z $BASE ]; then
for datadirtest in /share/HDA_DATA /share/HDB_DATA /share/HDC_DATA /share/HDD_DATA /share/MD0_DATA; do
[ -d $datadirtest/$PUBLIC_SHARE ] && BASE="/${publicdirp1}/${publicdirp2}"
done
fi
if [ -z $BASE ] ; then
echo "The Public share not found."
/sbin/write_log "[Serviio] The Public share not found." 1
exit 1
fi

QPKG_DIR=${BASE}/.qpkg/Xeams
JRE_QPKG_DIR=${BASE}/.qpkg/JRE
JAVA_HOME=$JRE_QPKG_DIR/jre

source /etc/profile
export LANG=en_US.UTF-8

export JAVA_HOME

/bin/echo $PATH | /bin/grep "/usr/local/jre/bin" 1>>/dev/null 2>>/dev/null
[ $? -ne 0 ] && export PATH=$PATH:/usr/local/jre/bin

case "$1" in
start)
ENABLED=$(/sbin/getcfg $QPKG_NAME Enable -u -d FALSE -f $CONF)
if [ "$ENABLED" != "TRUE" ]; then
/bin/echo "$QPKG_NAME is disabled."
exit 1
fi

if [ -d $JRE_QPKG_DIR ]; then
echo -n "JRE QPKG is installed "
if [ -d /usr/local/jre ]; then
echo "and enabled."
else
echo " but disabled. Please enable JRE QPKG."
/sbin/write_log "[Xeams] JRE QPKG is installed but disabled. Please enable JRE QPKG." 1
exit 1
fi
else
echo "JRE QPKG is not installed."
/sbin/write_log "[Xeams] JRE QPKG is not installed." 1
fi

echo -n "Attempting to start Xeams Server: "
cd $QPKG_DIR

CP=
for i in `ls lib/*.jar`
do
CP=$CP:$i
done

java -Dsun.jnu.encoding=UTF-8 -server -Xmx512m -cp $CP -DLoggingConfigFile=logconfig.xml com.synametrics.xeams.ServerStarter &
max_wait=60;
count=0;
status=1;
while [ ${count} -lt ${max_wait} ]
do
PID=`/bin/ps | /bin/grep -v grep | /bin/grep "Xeams" | awk '{print $1}'`
if [ -n "$PID" ] ; then
echo "Started after ${count} seconds.";
status=0;
break;
fi;
((count++))
done;
if [ $status -ne 0 ]; then
echo "Server failed to start"
fi;
;;

stop)
/bin/echo -n "Attempting to stop Xeams Server: "
PID=`/bin/ps | /bin/grep -v grep | /bin/grep "Xeams" | awk '{print $1}'`
#echo $PID
if [ -z "$PID" ] ; then
/bin/echo "Not running."
else
/bin/kill ${PID}
max_wait=60;
count=0;
status=1;
while [ ${count} -lt ${max_wait} ]
do
/bin/sleep 1
PID=`/bin/ps | /bin/grep -v grep | /bin/grep "Xeams" | awk '{print $1}'`
if [ -n "${PID}" ]; then
((count++));
continue;
else
break;
fi;
done;
/bin/echo "Stopped after ${count} seconds."
status=0;
fi
;;

restart)
$0 stop
if [ ${status} -eq 0 ]; then
$0 start
else
echo "Failure stopping server start not performed";
fi;
;;

*)
echo "Usage: $0 {start|stop|restart}"
exit 1
esac

exit ${status};