From: Arvin Schnell Date: Wed, 23 Feb 2011 10:37:14 +0000 (+0100) Subject: - improved logging X-Git-Tag: v0.1.3~463 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4431180d004f761cb44d70d7314ebb14807f3999;p=thirdparty%2Fsnapper.git - improved logging --- diff --git a/tools/compare-dirs.cc b/tools/compare-dirs.cc index 0dd4f072..93482485 100644 --- a/tools/compare-dirs.cc +++ b/tools/compare-dirs.cc @@ -3,6 +3,7 @@ #include #include +#include #include using namespace snapper; @@ -45,6 +46,14 @@ main(int argc, char** argv) daemon(0, 0); + initDefaultLogger(); + + string path1 = argv[1]; + string path2 = argv[2]; + string output = argv[3]; + + y2mil("compare-dirs path:" << path1 << " path2:" << path2 << " output:" << output); + struct sigaction act; act.sa_handler = terminate; sigemptyset(&act.sa_mask); @@ -53,19 +62,19 @@ main(int argc, char** argv) sigaction(SIGINT, &act, NULL); sigaction(SIGTERM, &act, NULL); - tmp_name = (char*) malloc(strlen(argv[3]) + 12); - strcpy(tmp_name, argv[3]); + tmp_name = (char*) malloc(output.length() + 12); + strcpy(tmp_name, output.c_str()); strcat(tmp_name, ".tmp-XXXXXX"); int fd = mkstemp(tmp_name); file = fdopen(fd, "w"); - cmpDirs(argv[1], argv[2], write_line); + cmpDirs(path1, path2, write_line); fclose(file); - rename(tmp_name, argv[3]); + rename(tmp_name, output.c_str()); free(tmp_name); diff --git a/tools/daily.cc b/tools/daily.cc index e25e178e..a194fb05 100644 --- a/tools/daily.cc +++ b/tools/daily.cc @@ -1,6 +1,7 @@ #include +#include #include #include @@ -16,8 +17,12 @@ main(int argc, char** argv) exit(EXIT_FAILURE); } + initDefaultLogger(); + string root = argv[1]; + y2mil("daily root:" << root); + Snapper* sh = createSnapper(root); sh->doCleanupAmount(); diff --git a/tools/hourly.cc b/tools/hourly.cc index f2462baa..8b8ba44e 100644 --- a/tools/hourly.cc +++ b/tools/hourly.cc @@ -1,6 +1,7 @@ #include +#include #include #include @@ -16,8 +17,12 @@ main(int argc, char** argv) exit(EXIT_FAILURE); } + initDefaultLogger(); + string root = argv[1]; + y2mil("hourly root:" << root); + if (root != "/") // TODO exit(EXIT_SUCCESS);