¾Æ ¾î·Æ´Ù..¸®´ª½º ÀÚµ¿ ¸®ºÎÆÃ

½Öcpu   
   Á¶È¸ 3803   Ãßõ 0    

 리눅스 서버 자바와 톰켓 관련 

메모리 치환 문제로 서비스가 내려가는 사태 

현재로서는 리부팅이 해결방안...

ㅠㅠ


혹시 특정 서비스 포트 443 포트가 내려갈 경우 서버를 리부팅해라~~! 하는

스크립을 작성해서 cron잡에 넣고자 하는데 조언 좀 부탁드립니다.


아 미치겄네유

ªÀº±Û Àϼö·Ï ½ÅÁßÇÏ°Ô.
Java ¿Í tomcat ´Ù½Ã ¼³Ä¡ ÇØ º¸¼Å¿ä.. Â÷±ÙÂ÷±Ù...
Path°¡ ¾Ê°É¸°°Ç ¾Æ´ÑÁö¿ä..
SSLÀÎÁõ¼­ ¹®Á¦ ¾Æ´Ò±î¿ä

Àú´Â PostFix ¶§¹®¿¡ ¹ÌÄ¡°í ÆȦ ¶Ù´Â ÁßÀÔ´Ï´Ù..
¿Ö ¸ÞÀÏÀÌ ¾ÊµÇ´ÂÁö..
Ç϶ó´Âµ¥·Î ¼ö½Ê¹øµµ ´õ Çߴµ¥..  4ÀÏ° ¸ÞÀÏÀÌ ¾Ê°¡¿ä...
SMTP send-only ¼³Á¤ Á» ¾Ë·ÁÁÖ¼¼¿ä...
REALHOST 2021-01
[Ãâó] https://xzio.tistory.com/26

* ÁÖÀÇ : ¼­¹ö¿¡ ÅèĹ 1°³¸¸ ¼³Ä¡µÇ¾î ÀÖ´Ù´Â °¡Á¤ÇÏ¿¡ ÀÛ¼º

--------------------------------------------------------------------------------------------------------
#!/bin/sh
 
export JAVA_HOME=/usr/local/java
export PATH="$PATH:$JAVA_HOME/bin"
export CATALINA_HOME=/usr/local/tomcat
 
Log=$CATALINA_HOME/logs/restart.log
DATE=`date +%Y%m%d-%H%M%S`
 
# ÅèĹ PID ã±â
tomcatPID=`ps -ef | grep tomcat | grep -v grep | grep -v vi | awk '{print $2}'`
 
# ÅèĹ ÇÁ·Î¼¼½º Ä«¿îÆ®
tomcatCnt=`ps -ef | grep tomcat | grep -v grep | grep -v vi | wc -l`
 
if [ $tomcatCnt -gt 0 ]
then
    echo "$DATE : TOMCATÀÌ Á¤»ó ÀÛµ¿ÁßÀÔ´Ï´Ù.(PID : tomcatPID)" >> $Log
else
    echo "$DATE : TOMCATÀ» ½ÃÀÛÇÕ´Ï´Ù(1)" >> $Log
   
    # ÅèĹ Àç½ÃÀÛ
    $CATALINA_HOME/bin/startup.sh
 
    tomcatPID=`ps -ef | grep tomcat | grep -v grep | grep -v vi | awk '{print $2}'`
    DATE=`date +%Y%m%d-%H%M%S`
 
    echo "$DATE : TOMCATÀÌ ½ÃÀ۵Ǿú½À´Ï´Ù.(PID : tomcatPID)" >> $Log
fi
 
 
echo "##############################################################################" >> $Log
--------------------------------------------------------------------------------------------------------


½ºÅ©¸³Æ®¸¦ ÀÛ¼ºÇÏ°í crontab µîÀ» ÀÌ¿ëÇÏ¿© ÁÖ±âÀûÀ¸·Î ½ÇÇà½ÃÄÑÁÖ¸é µÈ´Ù.

# ÅèĹ üũ. 1ºÐ¸¶´Ù
*/1 * * * * /home/tester/tomcatCheck.sh > /dev/null 2>&1
     
½Öcpu 2021-01
¾Æ ÅèÄÏ Àç½ÇÇà Çصµ ¹¹ ¶È°°½À´Ï´Ù.
¸Þ¸ð¸® ġȯ¹®Á¦ÀÎÁö ¹ºÁö ±âÁ¸ Ä¿³Ø¼ÇÀÌ ²÷±âÁö ¾Ê°í °è¼Ó ³²¾ÆÀÖ´Ù°¡ ´Ù¿îÀÌ
¤Ð¤Ð
REALHOST 2021-01
°Ë»öÇغ¸´Ï Àú·¸°Ô Çغ¸¶ó°í ³ª¿Í Àֳ׿ä. Âü°íÇÏ½Ã¸é µÉ¶æ ÇØ¿ä.
     
PostFix / SMTP send-only·Î ¼³Á¤ Çϴµ¥ ¾ÊµÇ´Âµ¥.. ÁÁÀº ¹æ¹ý ¾øÀ»±î¿ä??
ÀϹÝÀûÀÎ ¼³Á¤À¸·Î Çß½À´Ï´Ù.
LG ¶óÀÎÀε¥..
          
REALHOST 2021-01
¸ÞÀÏ ¹ß¼ÛÇßÀ»¶§ ·Î±×°¡ ¾î¶»°Ô ³²´ÂÁö ¾Ë¼ö ÀÖÀ»±î¿ä.
               
Jan 25 11:30:40 med31 postfix/pickup[11326]: 779BE5A2C2B: uid=0 from=<root@med31.ga>
Jan 25 11:30:40 med31 postfix/cleanup[11563]: 779BE5A2C2B: message-id=<20210125023040.779BE5A2C2B@med31.ga>
Jan 25 11:30:40 med31 postfix/qmgr[4538]: 779BE5A2C2B: from=<root@med31.ga>, size=321, nrcpt=1 (queue active)
Jan 25 11:30:42 med31 postfix/smtp[11565]: 779BE5A2C2B: to=<koredcap@gmail.com>, relay=gmail-smtp-in.l.google.com[74.125.203.26]:25, delay=1.9, delays=0/0/0.97/0.9, dsn=2.0.0, status=sent (250 2.0.0 OK  1611541842 r64si50667>
Jan 25 11:30:42 med31 postfix/qmgr[4538]: 779BE5A2C2B: removed


3¹ø ½Ãµµ Çߴµ¥. ¸ðµÎ ÀÌ·¸°Ô ³ª¿Ô³×¿ä...
                    
REALHOST 2021-01
¼³Ä¡ÇÑ OS °¡ ¾î¶²°ÇÁö ¾Ë¼ö ÀÖÀ»±î¿ä. ³»¿ëÀ¸·Î´Â ¾î·Á¿ö¼­. ¶È°°Àº ȯ°æÀÇ °¡»ó¼­¹ö ¸¸µé°í Postfix ¼³Ä¡Çؼ­ ¶È°°Àº ¿¡·¯°¡ ³ª´ÂÁö ¸ÞÀÏ ¹ß¼ÛÀÌ ÀߵǴÂÁö È®ÀÎ ÇÏ·Á°í ÇÕ´Ï´Ù.
Å×½ºÆ® ÈÄ¿¡ ÂÊÁö·Î °á°ú µå¸±²²¿ä.
                         
Ubuntu 20.04 ¿´½À´Ï´Ù.
                    
·Î±×»óÀ¸·Î¸¸ º¸¸é ¸ÞÀÏÀÌ Á¤»óÀûÀ¸·Î ¹ß¼ÛµÈ °Í ÀÔ´Ï´Ù¸¸?
gmail ÂÊ¿¡ Á¤Å©¸ÞÀÏ·Î µé¾î°£°Í ¾Æ´Ñ°¡¿ä?? ±×ÂÊ È®ÀÎÇغ¸½Ã±â ¹Ù¶ø´Ï´Ù.
º¸Åë º¸³»´Â ¸ÞÀÏ¿¡ root°¡ Æ÷ÇÔµÇ¸é ´ëºÎºÐ Á¤Å©·Î °¡´Â °æ¿ì°¡ ¸¹½À´Ï´Ù.
          
±èÁ¦¿¬ 2021-01
ÀÚü ¼­¹ö³¢¸®µµ ¾ÈµÇ³ª¿ä ? È­ÀÌÆ® ¸®½ºÆ®°ü·Ã ¹®Á¦ ¾Æ´Ò°¡¿ä?
epowergate 2021-01
"¸Þ¸ð¸® ġȯ ¹®Á¦·Î ¼­ºñ½º°¡ ³»·Á°¡´Â »çÅÂ" ÀÚü°¡ ¸»ÀÌ µÇÁú¾Ê½À´Ï´Ù.
"443 Æ÷Æ®°¡ ³»·Á°¥ °æ¿ì..."¶ó´Â°Íµµ ¸»ÀÌ µÇÁú¾Ê½À´Ï´Ù.
±×³É ÇÁ·Î±×·¥ÀÌ À߸ø ¸¸µé¾î Áø°Ì´Ï´Ù.
¾î¶² ÀÌÀ¯·Î ÇÁ·Î±×·¥ÀÌ ÇàÀÌ °É¸®°í ÇàÀÌ °É¸®¸é¼­ 443 Æ÷Æ® bind¸¦ Ç®Áö ¾Ê¾Ò°ÚÁÒ.

POSTFIX°¡ ¾ÈµÇ´Â°ÅÇÏ°í SMTP send-only°¡ °ü·ÃÀÌ ÀÖ³ª¿ä???
±×³É ´Ü¼øÇÏ°Ô ¹Þ´ÂÂÊ (gmail)¿¡¼­ µèº¸Àâ¿¡¼­ ¿À´Â À̸ÞÀÏÀ» ÇÊÅ͸µ Çعö¸®´Â°Ô ¾Æ´Ò±î¿ä?
     
½Öcpu 2021-01
±×·²±î¿ä? ½Ã°£ÀÌ Áö³ª¸é 443ÀÌ ¶³¾îÁö´õ±º¿ä
443¸¸ ´Ù¿îÀ̵Ê
ÇÁ·Î±×·¥ ¹®Á¦¶ó
À½  443À»  ¿Ã·Áµµ ¾È¿Ã¶ó°¡´Â
¤Ð¤Ð
Àç°¡µ¿ Çؾ߸¸ ÇÏ´Â ¤Ð¤Ð
ÀÏ´Ü ±Ùº»¹®Á¦±â ÇØ°áµÉ¶§ ±îÁö Àӽ÷Π»ç¿ëÇϽöó°í SHELL ½ºÅ©¸³Æ® ¿¹Á¦ º¸³»µå¸³´Ï´Ù.
Å©·ÐÅÇ¿¡ ÀÌ·±½ÄÀ¸·Î ½© ³ÖÀ¸½Ã¸é ¸®ºÎÆ® µÉ°Í °°½À´Ï´Ù.
½Ã³î·ÎÁö¿¡´Â ½ºÄÉÁì·¯¿¡ ½ÃÇèÇؼ­ Àß µ¿À۵Ǵ ½ºÅ©¸³Æ® ÀÔ´Ï´Ù.
--------------------------------------------------------------------------------------
nc -zv 127.0.0.1 443 &> /dev/null
if [ "$?" == "0" ]
then echo "OK"
else echo "NOT OK" ;  reboot
fi
     
¸®´ª½º¿Í ¸Æ¿¡¼­ ÃÖÁ¾ ½ÃÇè ¸¶Ä£ ½©½ºÅ©¸³Æ® ÀÔ´Ï´Ù.
root ±ÇÇÑÀ¸·Î ½ÇÇàÇÏ¼Å¾ß ÇÕ´Ï´Ù. Àß µ¿ÀÛ µË´Ï´Ù.


QnA
Á¦¸ñPage 804/5686
2015-12   1506457   ¹é¸Þ°¡
2014-05   4970145   Á¤ÀºÁØ1
2023-07   2453   µ·´ë½Å¸öÀ¸·Î
2016-01   4065   Çϳª·ë
2020-07   2201   ±Þ¿©ÀÏ¿¡¸¸³ª¿ä
2010-03   7344   ±è°Ç¿ì
2021-12   1396   µðÁöÀ¯
2010-03   7479   °¡ºü·Î±¸³ª
2010-03   26090   ÀϹÝÀ¯Àú
2016-01   4182   handan
2021-12   2748   ¹«¾Æ
2023-07   1239   ¾Ó²ô
2013-04   23046   ¹Ú³²±Ô
2016-02   3646   ȸ·ÎÀïÀÌ
2010-04   20884   ±ÇÁ¾ÀÏ
2013-04   12833   ¹æoÈ¿o¹®
2021-12   1560   ÀÌÈñÁÖ
2010-04   7885   ÀÌÁ¾¿ø
2019-05   2930   everess
2014-10   4696   DOSS
2016-02   4293   ±è¼º±â1
2018-03   3538   °ÇÀåÃÊÄÚ¹Ù