Enable Core Dumps for Daemons or Services in Red Hat Enterprise Linux

โดยทั่วไปแล้ว daemon เป็นการทำงานในรูปแบบ background process การสั่งให้ deamond ทำงานสามารถทำได้โดยใช้ service command หรือ ใช้ init script การเปิดใช้งาน core dump (ดูรายละเอียดของ core dump ได้ที่ Core dump file) เพื่อใช้งานการ debug ของโปรแกรมหรือตามความต้องการเพื่อตรวจสอบข้อผิดพลาดของโปรแกรม

การ enable core dump สำหรับ daemon หรือ service สามารถทำได้ดังนี้

  1. แก้ไขไฟล์  /etc/profile ด้วยคำสั่ง vi /etc/profile
  2.     แก้ไขบรรทัด
        ulimit -S -c 0 > /dev/null 2>&1
    
        แก้ไขเป็น
        ulimit -c unlimited >/dev/null 2>&1
  3. แก้ไขไฟล์ /etc/sysconfig/init ด้วยการเพิ่ม DAEMON_COREFILE_LIMIT=’unlimited’ เข้าไป
  4. โดยทั่วไปแล้ว core dump ไม่สามารถสร้างโดยโปรแกรมที่รันด้วย setuid เพื่อป้องกันข้อมูลรั่วไหลออกไปยัง user อื่น ดังนั้นเราจึงต้องแก้ไขให้สามารถทำ core dump ใน setuid program ด้วย
    • สำหรับ Red Hat Enterprise Linux 5:
    • echo 2 > /proc/sys/fs/suid_dumpable
    • สำหรับ Red Hat Enterprise Linux 4:
    • echo 2 > /proc/sys/kernel/suid_dumpable
    • สำหรับ Red Hat Enterprise Linux 3:
    • echo 1 > /proc/sys/kernel/core_setuid_ok
  5. แก้ไขไฟล์ /etc/sysctl.conf เพื่อเพิ่มข้อความด้านล่างลงไป
  6. fs.suid_dumpable = 2      # RHEL 5 only
    kernel.suid_dumpable = 2  # RHEL 4 only
    kernel.core_setuid_ok = 1 # RHEL 3 only
    kernel.core_pattern = /tmp/core
  7. Reload settings ด้วยการใช้คำสั่ง sysctl -p

ขอขอบคุณ Red Hat สำหรับข้อมูลครับ

Related posts:

  1. Controlling Core Dump Files in Linux Core dump อีกแล้ว!! คำพูดนี้เกิดขึ้นหลังจากที่เพื่อนคนหนึ่งได้โทรมาถามปัญหาเรื่องการใช้ rpm เสร็จ ตอนแรกก็งงๆ core...
  2. Red Hat Enterprise Linux 6 released Red Hat Enterprise Linux 6 หรือ RHEL 6...
  3. Improve disk performance for Red Hat Enterprise Linux running in a VMware and xen environment. ในระบบ virtualization เช่น VMWare หรือ Xen source จะมีการใช้งาน...
  4. Suggested I/O scheduler for a Video on Demand (VOD) server using Red Hat Enterprise Linux ในการใช้งาน VOD servers นั้นถ้าเราใช้ cfg scheduler นั้นเวลาที่มี connection...
  5. วิธีดู Version ของ Red Hat Enterprise Linux, Centos Linux วิธีการดู Version ของ Red Hat Enterprise Linux, Centos...

You can leave a response, or trackback from your own site.

Leave a Reply