Changeset 792


Ignore:
Timestamp:
Sep 13, 2006, 11:48:01 PM (11 years ago)
Author:
bruno
Message:

Fix Bug #24

  • Introduce kill_anything_like_this as a function instead of define
  • Add an external variable ps_options whose value is empty in restore and auxww in archive
Location:
branches/stable/mondo/mondo
Files:
6 edited

Legend:

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

    r681 r792  
    136136/* @} - end of globalGroup */
    137137
     138extern char *ps_options;
    138139
    139140/**
     
    210211    }
    211212    sleep(2);
    212     sprintf(tmp, "ps wwax | grep \"%s\"", g_sz_call_to_buffer);
     213    sprintf(tmp, "ps %s | grep \"%s\"", ps_options, g_sz_call_to_buffer);
    213214    if (run_program_and_log_output(tmp, 2)) {
    214215        log_msg(2, "Warning - I think I failed to open tape, actually.");
     
    216217    g_tape_buffer_size_MB = bufsize;
    217218    tmp[30] = '\0';
    218     sprintf(command, "ps wwax | grep buffer | grep -v grep");
     219    sprintf(command, "ps %s | grep buffer | grep -v grep", ps_options);
    219220    if (run_program_and_log_output(command, 1)) {
    220221        fres = NULL;
     
    242243    paranoid_system("sync");
    243244    sprintf(command,
    244             "ps wwax | grep -F \"%s\" | grep -Fv grep | awk '{print $1;}' | grep -v PID | tr -s '\n' ' ' | awk '{ print $1; }'",
     245            "ps | grep -F \"%s\" | grep -Fv grep | awk '{print $1;}' | grep -v PID | tr -s '\n' ' ' | awk '{ print $1; }'", ps_options,
    245246            g_sz_call_to_buffer);
    246247    log_msg(2, "kill_buffer() --- command = %s", command);
  • branches/stable/mondo/mondo/common/my-stuff.h

    r686 r792  
    439439 */
    440440#define MALLOC_CHECK_ 1
    441 
    442 /**
    443  * Kill any process containing the string @p x surrounded by spaces in its commandline.
    444  */
    445 #define kill_anything_like_this(x) {run_program_and_log_output("kill `ps wax | grep \"" x "\" | awk '{print $1;}' | grep -vx \"\\?\"`", TRUE);}
    446441
    447442/**
  • branches/stable/mondo/mondo/common/newt-specific.c

    r738 r792  
    128128    extern char *g_boot_mountpt;
    129129    extern char *g_mondo_home;
     130    extern char *ps_options;
    130131
    131132    extern void set_signals(int);
     
    340341    }
    341342
    342 
     343/**
     344 * Kill any process containing the string @p str surrounded by spaces in its commandline.
     345 */
     346void kill_anything_like_this(char *str) {
     347
     348char *tmp = NULL;
     349
     350asprintf(&tmp,"kill `ps %s | grep \"" %s "\" | awk '{print $1;}' | grep -vx \"\\?\"`", ps_options, str);
     351run_program_and_log_output(tmp, TRUE);
     352paranoid_free(tmp);
     353}
    343354
    344355
  • branches/stable/mondo/mondo/mondoarchive/main.c

    r541 r792  
    140140bool g_skip_floppies;
    141141long diffs;
     142char *ps_options = "auxww";
    142143
    143144extern t_bkptype g_backup_media_type;
  • branches/stable/mondo/mondo/mondorestore/mondo-restore.c

    r684 r792  
    488488 */
    489489char *g_mondo_home;
     490
     491char *ps_options = "";
    490492
    491493/* @} - end of "Restore-Time Globals" in globalGroup */
  • branches/stable/mondo/mondo/mondorestore/mondo-rstr-tools.c

    r746 r792  
    513513    malloc_string(command);
    514514    sprintf(command,
    515             "kill `ps wax 2> /dev/null | grep petris 2> /dev/null | grep -v grep | cut -d' ' -f2` 2> /dev/null");
     515            "kill `ps 2> /dev/null | grep petris 2> /dev/null | grep -v grep | cut -d' ' -f2` 2> /dev/null");
    516516    paranoid_system(command);
    517517    paranoid_free(command);
     
    21792179         &&
    21802180         run_program_and_log_output
    2181          ("ps wax | grep buffer | grep -v \"grep buffer\"", TRUE) == 0;
     2181         ("ps | grep buffer | grep -v \"grep buffer\"", TRUE) == 0;
    21822182         i++) {
    21832183        sleep(1);
Note: See TracChangeset for help on using the changeset viewer.