Forum OpenACS Q&A: Response to Search in AOLserver

Collapse
Posted by Krzysztof Kowalczyk on
Warning: this is pure, untested speculation. If you're running RedHat you can use the standard boot startup framework. In short you should chown nsadmin.nsadmin /usr/local/bin/search and setuid the binary (too lazy to check the syntax) so that search always starts as nsadmin process regardless of the user who executed it (this is admittedly an ugly kludge but it will take you where you want to go). Test this by loggin in as root and starting search - socket file should be created with permissions of nsadmin now.

As of starting a daemon on boot there is more than way to do it. One way: save the script that I attach at the end as /etc/rc.d/init.d/swishd and make it executable. Test it by executing swishd start (this should start the daemon). To make it start automatically execute chkconfig --add swishd. An alternative would be to just launch search from /etc/rc.d/rc.local. Detail of those approaches are beyond the scopy of this post. This is just general RedHat administration stuff. If you use other distribution there is probably a similar feature but details would be different.

#!/bin/sh
#
# swish:       Starts the Swish++ search daemon
#
# chkconfig: 345 43 77
# description: Starts and stops the search as daemon at boot time and shutdown.
# processname: search

# Source function library.
. /etc/rc.d/init.d/functions

# See how we were called.
case "$1" in
  start)
        echo -n "Starting Swish search"
        /usr/local/bin/search
        echo
        touch /var/lock/subsys/search
        ;;
  stop)
        echo -n "Shutting down Swish++ search"
        killproc search
        rm -f /var/lock/subsys/search
        echo
        ;;
  restart|reload)
        echo -n "Restarting Swish++ search daemon"
        $0 stop
        $0 start
        RETVAL=$?
        ;;
  *)
        echo "*** Usage: swishd {start|stop|restart|reload}"
        exit 1
esac

exit 0