wso2apache-axisaxisaxis2c

Can I run axis2_http_server in daemon mode?


I have written a web service using wso2-wsf-ccp framework and trying to run it with axis2_http_server and it works fine. But in real life when we deploy in production we need to run axis2_http_server in daemon mode. I dont see any option to run axis2_http_server in daemon mode. Can someone guide me if it is possible to do so..?


Solution

  • Best method to deploy web services under Axis2/C is to use mod_axis2 for Apache2. When this method is used Axis2/C will be started as Apache2 module on system startup.

    Here and here are documentations on how to configure and install Axis2/C to build with mod_axis2.

    Alternatively, if you can't use mod_axis2, Axis2/C can be started in daemon mode using this init.d script (it's not perfect but does work):

    #!/bin/sh -e
    ### BEGIN INIT INFO
    # Provides:          axis2c
    # Required-Start:    $local_fs $network
    # Required-Stop:
    # Default-Start:     2 3 4 5
    # Default-Stop:      0 1 6
    # Short-Description: Start Axis2/C application server
    ### END INIT INFO
    
    case "$1" in
      start)
        LOGFILE=/var/log/axis2c.log
        touch $LOGFILE
        chown daemon $LOGFILE
        export AXIS2C_HOME=/usr/local/axis2c
        cd $AXIS2C_HOME/bin
        sudo -Enu daemon sh -c "./axis2_http_server >$LOGFILE 2>&1 &"
        ;;
    
      stop)
        killall -INT axis2_http_server
        ;;
    
      restart|force-reload)
        $0 stop
        $0 start
        ;;
    
      *)
        echo "Usage: $0 {start|stop|restart|force-reload}" >&2
        exit 1
        ;;
    esac
    

    Place this script as /etc/init.d/axis2c, make it executable and start:

    sudo update-rc.d axis2c defaults
    

    After that Axis2/C will be automatically loaded on each system startup.