Changeset 928 in MondoRescue for branches/stable/mondo/src/common


Ignore:
Timestamp:
Nov 13, 2006, 10:17:07 AM (19 years ago)
Author:
Bruno Cornec
Message:

ps (busybox) and ps (system) do not give PID in the same column. Adapted with a global variable.

Location:
branches/stable/mondo/src/common
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/stable/mondo/src/common/libmondo-fifo.c

    r797 r928  
    137137
    138138extern char *ps_options;
     139extern char *ps_proc_id;
    139140
    140141/**
     
    233234/**
    234235 * Kill @c buffer processes.
     236 * Only called in mondoarchive
    235237 */
    236238void kill_buffer()
     
    243245    paranoid_system("sync");
    244246    sprintf(command,
    245             "ps %s | grep -F \"%s\" | grep -Fv grep | awk '{print $1;}' | grep -v PID | tr -s '\n' ' ' | awk '{ print $1; }'", ps_options,
     247            "ps %s | grep -F \"%s\" | grep -Fv grep | awk '{print $2;}' | grep -v PID | head -1", ps_options,
    246248            g_sz_call_to_buffer);
    247249    log_msg(2, "kill_buffer() --- command = %s", command);
  • branches/stable/mondo/src/common/newt-specific.c

    r883 r928  
    129129    extern char *g_mondo_home;
    130130    extern char *ps_options;
     131    extern char *ps_proc_id;
    131132
    132133    extern void set_signals(int);
     
    348349char *tmp = NULL;
    349350
    350 asprintf(&tmp,"kill `ps %s | grep \" %s \" | awk '{print $1;}' | grep -vx \"\\?\"`", ps_options, str);
     351asprintf(&tmp,"kill `ps %s | grep \" %s \" | awk '{print %s;}' | grep -vx \"\\?\"`", ps_options, str , ps_proc_id);
    351352run_program_and_log_output(tmp, TRUE);
    352353paranoid_free(tmp);
Note: See TracChangeset for help on using the changeset viewer.