X-Git-Url: http://git.tuebingen.mpg.de/?a=blobdiff_plain;f=dss.c;h=f8a1e5132dfd3954bd2242b2f38d6deb384ffa9e;hb=006e516739869cba59b3be6e15a2879273c53cfe;hp=af1326fd5ad4d7262814d85f3dbdb203c9736fb8;hpb=b8c18ccfb0dbe89c9a35d4989cd506b8461ea850;p=dss.git diff --git a/dss.c b/dss.c index af1326f..f8a1e51 100644 --- a/dss.c +++ b/dss.c @@ -502,6 +502,8 @@ static int handle_rsync_exit(int status) DSS_WARNING_LOG("rsync process %d returned %d -- restarting\n", (int)rsync_pid, es); snapshot_creation_status = SCS_RSYNC_NEEDS_RESTART; + gettimeofday(&next_snapshot_time, NULL); + next_snapshot_time.tv_sec += 60; ret = 1; goto out; } @@ -693,6 +695,21 @@ out: return ret; } +/* + * We can not use rsync locally if the local user is different from the remote + * user or if the src dir is not on the local host (or both). + */ +static int use_rsync_locally(char *logname) +{ + char *h = conf.remote_host_arg; + + if (strcmp(h, "localhost") && strcmp(h, "127.0.0.1")) + return 0; + if (conf.remote_user_given && strcmp(conf.remote_user_arg, logname)) + return 0; + return 1; +} + static void create_rsync_argv(char ***argv, int64_t *num) { char *logname, *newest; @@ -716,7 +733,7 @@ static void create_rsync_argv(char ***argv, int64_t *num) } else DSS_INFO_LOG("no previous snapshot found\n"); logname = dss_logname(); - if (conf.remote_user_given && !strcmp(conf.remote_user_arg, logname)) + if (use_rsync_locally(logname)) (*argv)[i++] = dss_strdup(conf.source_dir_arg); else (*argv)[i++] = make_message("%s@%s:%s/", conf.remote_user_given? @@ -964,8 +981,12 @@ static int com_ls(void) struct snapshot *s; dss_get_snapshot_list(&sl); - FOR_EACH_SNAPSHOT(s, i, &sl) - dss_msg("%u\t%s\n", s->interval, s->name); + FOR_EACH_SNAPSHOT(s, i, &sl) { + int64_t d = 0; + if (s->flags & SS_COMPLETE) + d = (s->completion_time - s->creation_time) / 60; + dss_msg("%u\t%s\t%3" PRId64 ":%02" PRId64 "\n", s->interval, s->name, d/60, d%60); + }; free_snapshot_list(&sl); return 1; }