Changeset 3141 in MondoRescue for branches/3.0


Ignore:
Timestamp:
Jun 13, 2013, 6:05:57 PM (11 years ago)
Author:
Bruno Cornec
Message:

r5345@localhost: bruno | 2013-06-13 12:46:54 +0200

  • Solving #702 by adding a -F option which is meant to be used especially when mondoarchive is launched from cron, to avoid going into a loop where mondoarchive asks questions to the admin, where they cannot be answerd, which fills the logs and the underlying file system. With -F mondoarchive will exits at the first interaction request instead.
Location:
branches/3.0
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • branches/3.0/mondo-doc/mondoarchive.8

    r3138 r3141  
    273273
    274274.TP
     275.BI "\-F "
     276Do not retry when a command failed but just exits. This is useful for an
     277automated mode launched from cron where you want to avoid filling your logs
     278due to an answer which is impossible to give.
     279
     280.TP
    275281.BI "\-G "
    276282Use gzip, the standard and quicker Linux compression engine, instead of bzip2.
  • branches/3.0/mondo/src/common/libmondo-cli.c

    r3138 r3141  
    2020extern int g_loglevel;
    2121extern bool g_text_mode;
     22extern bool g_fail_immediately;
    2223extern char g_startdir[MAX_STR_LEN];    ///< ????? @bug ?????
    2324extern char *MONDO_OPTIONS;
     
    909910                ("Please install LZOP. You can't use '-L' until you do.\n");
    910911        }
     912    }
     913
     914    if (flag_set['F']) {
     915        log_msg(3, "-F means we will fail immediately at the first interaction request");
     916        g_fail_immediately = TRUE;
    911917    }
    912918
  • branches/3.0/mondo/src/common/libmondo-filelist.c

    r3139 r3141  
    214214    char *incoming = NULL;
    215215    char *tmp = NULL;
    216     char *p = NULL;
    217216
    218217    /*@ pointers *********************************** */
     
    920919    for (tmp1 = fgets(fname, MAX_STR_LEN, pin); !feof(pin);
    921920         tmp1 = fgets(fname, MAX_STR_LEN, pin)) {
    922         if ((fname[strlen(fname) - 1] == 13
    923              || fname[strlen(fname) - 1] == 10) && strlen(fname) > 0) {
     921        if (((fname[strlen(fname) - 1] == 13) || (fname[strlen(fname) - 1] == 10)) && (strlen(fname) > 0)) {
    924922            fname[strlen(fname) - 1] = '\0';
    925923        }
  • branches/3.0/mondo/src/common/newt-specific.c

    r3114 r3141  
    5555 */
    5656    bool g_exiting = FALSE;
     57
     58// Decide whether we should continue to ask questions or exit (cron use case)
     59extern bool g_fail_immediately;
    5760
    5861/**
     
    125128        char *p;
    126129
    127          assert_string_is_neither_NULL_nor_zerolength(prompt);
    128 
     130        assert_string_is_neither_NULL_nor_zerolength(prompt);
     131
     132        if (g_fail_immediately) {
     133            // We consider the user aborted by using the -F option
     134            log_msg(3, "Exiting at first interaction request due to -F");
     135            finish(1);
     136        }
    129137        if (g_text_mode) {
    130138
     
    179187        int i;
    180188
     189        assert_string_is_neither_NULL_nor_zerolength(prompt);
     190        if (g_fail_immediately) {
     191            // We consider the user aborted by using the -F option
     192            log_msg(3, "Exiting at first interaction request due to -F");
     193            finish(1);
     194        }
    181195        tmp = malloc(MAX_NEWT_COMMENT_LEN);
    182         assert_string_is_neither_NULL_nor_zerolength(prompt);
    183196        if (g_text_mode) {
    184197            paranoid_system("sync");
  • branches/3.0/mondo/src/mondoarchive/mondoarchive.c

    r3060 r3141  
    4545 */
    4646bool g_ISO_restore_mode = FALSE;
     47
     48/* Whether we should fail immediately at first error */
     49bool g_fail_immediately = FALSE;
    4750
    4851/* Do we use extended attributes and acl ?
  • branches/3.0/mondo/src/mondoarchive/mondoarchive.h

    r3139 r3141  
    99 */
    1010char *MONDO_LOGFILE = "/var/log/mondoarchive.log";
    11 char *MONDO_OPTIONS = "0123456789A:B:C:DE:GHI:J:K:LM:NOP:QRS:T:UVWb:c:d:ef:gik:l:mn:op:rs:tuw:x:z";
     11char *MONDO_OPTIONS = "0123456789A:B:C:DE:FGHI:J:K:LM:NOP:QRS:T:UVWb:c:d:ef:gik:l:mn:op:rs:tuw:x:z";
    1212
    1313/* No restriction on ps options */
  • branches/3.0/mondo/src/mondorestore/mondorestore.c

    r3116 r3141  
    6363 */
    6464bool g_ISO_restore_mode = FALSE;    /* are we in Iso Mode? */
     65
     66/* Whether we should fail immediately at first error */
     67bool g_fail_immediately = FALSE;
    6568
    6669/**
  • branches/3.0/mondo/test/test-mountlist.c

    r2991 r3141  
    2626extern int g_partition_table_locked_up;
    2727extern int g_noof_rows;
     28
     29/* Whether we should fail immediately at first error */
     30bool g_fail_immediately = FALSE;
    2831
    2932bool g_ISO_restore_mode = FALSE;    /* are we in Iso Mode? */
  • branches/3.0/mondo/test/test-mr_stresc.c

    r3116 r3141  
    88#include <stdlib.h>
    99#include "mr_str.h"
     10#include "my-stuff.h"
     11
     12/* Whether we should fail immediately at first error */
     13bool g_fail_immediately = FALSE;
    1014
    1115void (*mr_cleanup)(void) = NULL;
    1216
    13 char **strl = {
     17char *strl[] = {
    1418        "test with space",
    1519        "test with \ backslash",
  • branches/3.0/mondo/test/test-truncname.c

    r3116 r3141  
    2222extern int g_partition_table_locked_up;
    2323extern int g_noof_rows;
     24
     25/* Whether we should fail immediately at first error */
     26bool g_fail_immediately = FALSE;
    2427
    2528bool g_ISO_restore_mode = FALSE;    /* are we in Iso Mode? */
Note: See TracChangeset for help on using the changeset viewer.