본문 바로가기

WEB-SERVER/OHS & JBCS & Apache

[JBCS 2.4.62] 일반 OS 유저가 1024 이하 Port 사용하는 방법

728x90

그런거 없다.

 

기동 시에 sudo 명령어를 통하여 하는 방법 말고는 없다.

vi /etc/sudoers

 

apache 라는 계정으로 jbcs를 사용한다고 예를 들면, 다음과 같이 sudo 권한을 apache 에게 주자

 

start.sh

#/bin/sh/
HTTPD_HOME=/GCLOUD/APACHE/jbcs-httpd24-2.4/httpd
PATH=$HTTPD_HOME/sbin:$PATH
LD_LIBRARY_PATH=$HTTPD_HOME/lib:$LD_LIBRARY_PATH
export LD_LIBRARY_PATH HTTPD_HOME PATH
if [ `ps -ef | grep "/sbin/httpd" | grep "root" | grep -v " grep" | wc -l` -eq 0 ]; then
     sudo $HTTPD_HOME/sbin/apachectl -k start
     sleep 1

     if [ `ps -ef | grep httpd | grep -v "grep" | wc -l` -ge 1 ]; then
          echo -e "\nApache Status = $(ps -ef | grep "/sbin/httpd" | grep "root" | grep -v grep | awk '{print "\tPID : " $2, "\tLocation : "$8}')"
          echo -e "httpd process is running.\n"
     else
          echo -e "\nhttpd process is not running.\n"
     fi
else
     echo -e "\nhttpd process is running.\n"
fi

 

 

stop.sh

#!/bin/sh
HTTPD_HOME=/GCLOUD/APACHE/jbcs-httpd24-2.4/httpd
PATH=$HTTPD_HOME/sbin:$PATH
LD_LIBRARY_PATH=$HTTPD_HOME/lib:$LD_LIBRARY_PATH

export LD_LIBRARY_PATH HTTPD_HOME PATH

if [ `ps -ef | grep httpd | grep "root" | grep -v "grep" | wc -l` -eq 0 ]; then
     echo -e "\nhttpd process is stoped.\n"
else

     sudo $HTTPD_HOME/sbin/apachectl -k stop
     sleep 1
     if [ `ps -ef | grep "/sbin/httpd" | grep "root" | grep -v "grep" | wc -l` -eq 0 ]; then
          echo -e "\nhttpd process is stoped.\n"
     else
          echo -e "\nApache Status = $(ps -ef | grep "/sbin/httpd" | grep "root" | grep -v grep | awk '{print "\tPID : " $2, "\tLocation : "$8}')"
          echo -e "httpd process is running.\n"
     fi
fi

 

이렇듯 기동/정지 할 때, sudo 권한을 통하여 동작 시켜야 하는 것을 확인할 수 있다.