CentOS ¼­ºñ½º·Î ½ÇÇà½Ã ÇÁ·Î¼¼½º°¡ ¾È ¿Ã¶ó¿É´Ï´Ù.

Rime   
   Á¶È¸ 3497   Ãßõ 1    

서비스로 등록을 하려고 /etc/init.d 아래에 아래와 같은 소스로 파일을 만들었습니다.

start할 시에 자바 프로그램을 실행하도록 되어 있는데요.

이상하게도 service servicename start를 했을때는 java가 실행이 되질 않는데..

동일한 경로에서 ./servicename start를 할 경우 java가 정상적으로 올라옵니다......

이것때문에 몇일째 막히고 있는데요. 이런 해괴한 현상은 처음 봅니다.... ㅠㅠ... 대체 이유가 뭘까요?


#!/bin/sh
SERVICE_NAME=pda_8080
PATH_TO_JAR=/home/kdexp/pda_8080.jar
PID_PATH_NAME=/tmp/pda_8080
JAVA_OPTS="-server -Dserver.port=8080 -Dspring.profiles.active=prod -Xms2G -Xmx6G -XX:MaxMetaspaceSize=128M -XX:NewSize=512M -XX:MaxNewSize=512M -XX:+UseG1GC -XX:+DisableExplicitGC -Dfile.encoding=UTF-8 -Djna.nosys=true -Duser.timezone="Asia/Seoul" -verbose:gc -XX:+PrintGCDetails -XX:+PrintGCDateStamps -Xloggc:/home/kdexp/logs/gc.log -XX:+UseGCLogFileRotation -XX:NumberOfGCLogFiles=10 -XX:GCLogFileSize=100M -XX:+HeapDumpOnOutOfMemoryError -Djava.rmi.server.hostname=14.63.160.216 -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.port=15410"
case $1 in
start)
echo "Starting $SERVICE_NAME ..."
if [ ! -f $PID_PATH_NAME ]; then
nohup java $JAVA_OPTS -jar $PATH_TO_JAR /tmp 2>> /dev/null >> /dev/null &
echo $! > $PID_PATH_NAME
echo "java $JAVA_OPTS -jar $PATH_TO_JAR"
echo "$SERVICE_NAME started ..."
else
echo "$SERVICE_NAME is already running ..."
fi
;;
stop)
if [ -f $PID_PATH_NAME ]; then
PID=$(cat $PID_PATH_NAME);
echo "$SERVICE_NAME stoping ..."
kill $PID;
echo "$SERVICE_NAME stopped ..."
rm $PID_PATH_NAME
else
echo "$SERVICE_NAME is not running ..."
fi
;;
restart)
if [ -f $PID_PATH_NAME ]; then
PID=$(cat $PID_PATH_NAME);
echo "$SERVICE_NAME stopping ...";
kill $PID;
echo "$SERVICE_NAME stopped ...";
rm $PID_PATH_NAME
echo "$SERVICE_NAME starting ..."
nohup java $JAVA_OPTS -jar $PATH_TO_JAR /tmp 2>> /dev/null >> /dev/null &
echo $! > $PID_PATH_NAME
echo "$SERVICE_NAME started ..."
else
echo "$SERVICE_NAME is not running ..."
fi
;;
esac

ªÀº±Û Àϼö·Ï ½ÅÁßÇÏ°Ô.
TRUE 2017-05
±ÇÇÑ ¹®Á¦·Î ÃßÁ¤ÇÕ´Ï´Ù.
Villanus 2017-05
centos ¹öÁ¯ ¾ó¸¶ÀÎÁöµµ ¾Ë·ÁÁÖ¼Å¾ß ÇÒµí
6À̸é
chmod a+x /etc/init.d/servicename
chcon -t initrc_exec_t servicename
chkconfig --add servicename
chkconfig --level 3 4 5 servicename on
¼øÀ¸·Î ÇØÁÖ¼¼¿ä.
     
È­¶õ 2017-05
¿Í... Àå¾Öó¸® Àü¹®°¡ ȤÀº °­»çºÐ °°¾Æ¿ä~

±ÇÇÑÀº ±âº»ÀÌ°í ¼­ºñ½º µî·Ï±îÁö^^
epowergate 2017-05
"java" PATH¸¦ ¸øã´Â°Ì´Ï´Ù.
"PATH_TO_JAR=/home/kdexp/pda_8080.jar" Çϼ̴ø °Íó·³ "JAVA_PATH" Á¤µµ ¸¸µé¾î¼­ ³Ö¾îÁÖ½Ã¸é µË°Ì´Ï´Ù.
ZSNET5 2017-05
Path¹®Á¦°¡ ¾Æ´Ï¶ó, ±ÇÇÑ(º¸¾È)¹®Á¦ ¸Â½À´Ï´Ù.


QnA
Á¦¸ñPage 1376/5680
2015-12   1482433   ¹é¸Þ°¡
2014-05   4945735   Á¤ÀºÁØ1
2018-11   3498   ÆÐŶ½ºÆ®¸²
2014-06   3498   ¹Ú°Ç
2019-04   3498   ³¶¸¸ÄÉÀÌ
2018-11   3498   °í¹«´Ù¶óÀÌ
2019-12   3498   ºò³Ê±¼¸Ç
2018-04   3498   ÀÌÈñÁÖ
2017-03   3498   ´ÏÆ÷
2017-05   3498   Rime
2020-03   3498   ¼öÆÛ½ÎÀ̾ð
2018-03   3498   dongcheol
2019-03   3498   °ø»ó°¡
2015-12   3498   À©µµ¿ì10
2014-08   3498   ²Þ²ÙÁö¸¶
2018-03   3498   Á¤ÀºÁØ1
2017-08   3498   ºÒ¾Ë¿Õ
2018-10   3498   Ȧ¸¯0o0
2018-08   3498   LINKINPARK
2018-11   3498   s±èÁ¾È­z
2018-09   3498   ¹Î»çÀå
2023-02   3498   µö¸¶Àεå