AlkantarClanX12

Your IP : 18.226.93.22


Current Path : /proc/thread-self/root/usr/local/lsws/admin/misc/
Upload File :
Current File : //proc/thread-self/root/usr/local/lsws/admin/misc/ap_lsws.sh

#!/bin/sh

ARGS="$@"
ARG1="$1"

LSWS_HOME=/usr/local/lsws
APACHE_BIN=/usr/sbin/httpd

CTRL_APACHE=0

APACHE=/usr/sbin/httpd_ls_bak


LSWS=$LSWS_HOME/bin/lswsctrl
PARAM_LOG=$LSWS_HOME/logs/ap_cmd_param.log
APACHE_STATE=$LSWS_HOME/admin/cgid/apache_state

ulimit -v unlimited 2>/dev/null

if [ ! -f $LSWS ]; then
    mv $APACHE $APACHE_BIN
    $APACHE_BIN "$@"
    exit $?
fi

echo "`date`: $@" 2>/dev/null >> $PARAM_LOG 

if [ "x$ARG1" = 'x-DSSL' ] || [ "x$ARG1" = 'x-DFOREGROUND' ]; then
   shift
   ARG1=$1
fi

if [ "x$ARG1" = 'x' ]; then
    service lsws restart
    if [ "x$CTRL_APACHE" = "x1" ]; then
        $APACHE "$@"
    fi
    
elif [ "x$ARG1" = 'x-k' ]; then
    ARG2=$2
    case $ARG2 in
    start|startssl|sslstart|start-SSL)
    echo "START" > $APACHE_STATE
    service lsws restart
    ERR=$?
    if [ "x$CTRL_APACHE" = "x1" ]; then
        $APACHE "$@"
    fi
    exit $ERR
    ;;
    stop|graceful-stop)
    # never stop LSWS here, use "service lsws stop" instead
    # have to stop lsws or make cPanel belive apache is stopped,
    # otherwise cpanel will send signal "9"
    $LSWS stophttpd
    if [ "x$CTRL_APACHE" == "x1" ]; then
        $APACHE "$@"
    else
        echo ""
    fi
    ;;
    restart|graceful)
    echo "START" > $APACHE_STATE
    service lsws restart
    if [ "x$CTRL_APACHE" = "x1" ]; then
        $APACHE "$@"
    fi
    ;;
    *)
    $APACHE "$@"
    esac
else
    if [ "x$ARG1" = "xuninstall" ]; then
        if [ "x$CTRL_APACHE" = "x0" ]; then
            service lsws stop
            sleep 1
        fi
        mv $APACHE $APACHE_BIN
        $APACHE_BIN 
    elif [ "x$ARG1" = "xinstall" ]; then
        if [ "x$CTRL_APACHE" = "x0" ]; then
            pkill `basename $APACHE_BIN`
        fi
        echo "START" > $APACHE_STATE
        service lsws start
    else
        $APACHE "$@"
    fi
fi

ERROR=$?
exit $ERROR