How do I know if the Linux server killed my process and which process it killed?

608

It's quite possibly OOM killer, killed your process. You may be able to find out what when etc by looking in the logs.

egrep -i 'killed process' /var/log/messages

The actual log file varies by distribution so it could also be /var/log/syslog or even

egrep -i -r 'killed process' /var/log
Share:
608

Related videos on Youtube

Mazaher
Author by

Mazaher

Updated on September 18, 2022

Comments

  • Mazaher
    Mazaher over 1 year

    I have a table with columns ItemCode , ItemCount, ExpiredDate in which the expired date of items are saved when stocks of items increase. I have a View which shows current stocks of my items and it's columns are ItemCode and ItemStock.

    Table

    ItemCode, ItemCount, ExpiredDate
    1001    , 200      , 2010/01/01
    1001    , 100      , 2020/02/01
    1001    , 200      , 2021/03/01
    1002    , 150      , 2020/03/01
    

    View

    ItemCode, ItemStock
    1001    , 250
    1002    , 40
    1003    , 50
    1004    , 60
    

    I want a query that returns closest expired date according to items stock.

    Result

    ItemCode, ClosestExpirationDate
    1001    , 2020/02/01
    1002    , 2020/03/01
    1003    , -----
    1004    , -----
    
    • David Portabella
      David Portabella over 7 years
    • Mazaher
      Mazaher almost 6 years
      i need ms sql query
    • Gordon Linoff
      Gordon Linoff almost 6 years
      I think you want the closest in the future, which is somewhat different.
  • Admin
    Admin almost 11 years
    Not only OOM killer can kill your process. Have a look at both dmesg and /var/log/messages. Also look at your application log to see if something went wrong before it was killed. Avoid using grep to parse log files, you could miss a line like this one : Jun 10 04:02:07 servername kernel: programname[3324]: segfault at 000000000000001a rip 00002af7f092dcd4 rsp 00007fff010ddf68 error 4
  • Petter H
    Petter H almost 11 years
    also, just because the oom killer kills a process, that does not mean that the process killed is the one causing trouble,.
  • user9517
    user9517 almost 11 years
    @befreeandgood:grep is the perfect tool for the job when, like I was, you are looking for a articular piece of text. Why don't you provide your own answer then there's plenty of room in the database for them.
  • Mazaher
    Mazaher almost 6 years
    thanks for your reply. I run the query and it returns error: Incorrect syntax near 'order'.
  • Michał Turczyn
    Michał Turczyn almost 6 years
    @Mazaher What SQL version do you use?
  • Mazaher
    Mazaher almost 6 years
    2008 sqlexpress
  • Mazaher
    Mazaher almost 6 years
    it always returns first record. but i need record based on stock