Changeset 1850


Ignore:
Timestamp:
Jan 4, 2008, 6:51:30 PM (11 years ago)
Author:
bruno
Message:

before killing a process test that there is a result to ps (avoid whom to kill messages)

Location:
branches/2.2.5/mondo/src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/2.2.5/mondo/src/common/newt-specific.c

    r1747 r1850  
    350350
    351351char *tmp = NULL;
    352 
    353     asprintf(&tmp,"kill `ps %s | grep \" %s \" | awk '{print %s;}' | grep -v \"grep\"`", ps_options, str , ps_proc_id);
     352char *tmp1 = NULL;
     353
     354    asprintf(&tmp,"ps %s | grep \" %s \" | awk '{print %s;}' | grep -v \"grep\"", ps_options, str , ps_proc_id);
    354355    run_program_and_log_output(tmp, TRUE);
     356    if (strlen(tmp) > 0) {
     357        asprintf(&tmp1,"kill %s", tmp);
     358        run_program_and_log_output(tmp1, TRUE);
     359        paranoid_free(tmp1);
     360    }
    355361    paranoid_free(tmp);
    356362}
  • branches/2.2.5/mondo/src/mondorestore/mondo-rstr-tools.c

    r1848 r1850  
    169169char *g_getfacl = NULL;
    170170
     171extern void kill_anything_like_this(char *str);
     172
    171173/**
    172174* @addtogroup restoreUtilityGroup
     
    514516* Kill all Petris processes.
    515517*/
    516 void kill_petris(void)
    517 {
    518 char *command;
    519 malloc_string(command);
    520 sprintf(command,
    521     "kill `ps 2> /dev/null | grep petris 2> /dev/null | grep -v grep | cut -d' ' -f2` 2> /dev/null");
    522 paranoid_system(command);
    523 paranoid_free(command);
     518void kill_petris(void) {
     519    kill_anything_like_this("petris")
    524520}
    525521
Note: See TracChangeset for help on using the changeset viewer.