view scripts/server-ctl @ 7906:470616e64414

issue2551334 - get test suite running under windows Fix test_cgi under windows. Few classes of errors: 1) comparing paths with a/b (unix) to a\b (windows). Use normpath to fix it. Also change regexps used for path matching to use either \ or / for directory separators. 2) database not being closed preventing deletion of test case directory. Windows doesn't allow deletion of open files. In some cases replaced calling client.inner_mail() with main() because main() makes sure to close the database. In other cases assigned self.db = client.db beacuse client reopens the database and closes the original self.db. Reassigning allows tearDown to close the last opened handle to a db. 3) commit the admin password to the database. If it's not commited calling the code sometimes comes up with a different admin password. Not sure why we don't see this on linux. 4) run commit() on database so that sqlite databases can be closed and deleted. Unit tests don't call the main entry points that have finally clauses to close the databases properly, so do it in the test. 5) split tests that try to resolve symbolic links in the template directory to a separate method. Under windows user needs special permissions to creae symbolic links, so I report the method is skipped if creating a link fails.
author John Rouillard <rouilj@ieee.org>
date Sat, 27 Apr 2024 23:19:51 -0400
parents 311ad623e2d1
children
line wrap: on
line source

#!/bin/sh

#
# Configuration
#
CONFFILE="/var/roundup/server-config.ini"

# this will end up with extra space, but it should be ignored in the script
PIDFILE=`grep '^pidfile' ${CONFFILE} | awk -F = '{print $2}' `
SERVER="/usr/local/bin/roundup-server -C ${CONFFILE}"
ERROR=0
ARGV="$@"
if [ "x$ARGV" = "x" ] ; then
    ARGS="help"
fi

if [ -z "${PIDFILE}" ] ; then
    echo "pidfile option must be set in configuration file"
    exit 1
fi

for ARG in $@ $ARGS
do
    # check for pidfile
    if [ -f $PIDFILE ] ; then
	PID=`cat $PIDFILE`
	if [ "x$PID" != "x" ] && kill -0 $PID 2>/dev/null ; then
	    STATUS="roundup-server (pid $PID) running"
	    RUNNING=1
	else
	    STATUS="roundup-server (pid $PID?) not running"
	    RUNNING=0
	fi
    else
	STATUS="roundup-server (no pid file) not running"
	RUNNING=0
    fi

    case $ARG in
    start)
	if [ $RUNNING -eq 1 ] ; then
	    echo "$0 $ARG: roundup-server (pid $PID) already running"
	    continue
	fi
	if $SERVER ; then
	    echo "$0 $ARG: roundup-server started"
	else
	    echo "$0 $ARG: roundup-server could not be started"
	    ERROR=1
	fi
	;;
    condstart)
	if [ $RUNNING -eq 1 ] ; then
	    continue
	fi
	if $SERVER ; then
	    echo "$0 $ARG: roundup-server started"
	else
	    echo "$0 $ARG: roundup-server could not be started"
	    ERROR=1
	fi
	;;
    stop)
	if [ $RUNNING -eq 0 ] ; then
	    echo "$0 $ARG: $STATUS"
	    continue
	fi
	if kill $PID ; then
	    echo "$0 $ARG: roundup-server stopped"
	else
	    echo "$0 $ARG: roundup-server could not be stopped"
	    ERROR=2
	fi
	;;
    status)
	echo $STATUS
	;;
    *)
	echo "usage: $0 (start|condstart|stop|status)"
	cat <<EOF

    start      - start roundup-server
    condstart  - start roundup-server if it's not running
    stop       - stop roundup-server
    status     - display roundup-server status

EOF
	ERROR=3
    ;;

    esac

done

exit $ERROR


Roundup Issue Tracker: http://roundup-tracker.org/