Browse Source

Store pool and user logs in separate subdirectories

master
Con Kolivas 10 years ago
parent
commit
9d04e11bb6
  1. 12
      src/ckpool.c
  2. 10
      src/stratifier.c

12
src/ckpool.c

@ -1226,6 +1226,18 @@ int main(int argc, char **argv)
if (ret && errno != EEXIST)
quit(1, "Failed to make log directory %s", ckp.logdir);
/* Create the user logdir */
sprintf(buf, "%s/users", ckp.logdir);
ret = mkdir(buf, 0750);
if (ret && errno != EEXIST)
quit(1, "Failed to make user log directory %s", buf);
/* Create the pool logdir */
sprintf(buf, "%s/pool", ckp.logdir);
ret = mkdir(buf, 0750);
if (ret && errno != EEXIST)
quit(1, "Failed to make pool log directory %s", buf);
/* Create the logfile */
sprintf(buf, "%s%s.log", ckp.logdir, ckp.name);
ckp.logfp = fopen(buf, "ae");

10
src/stratifier.c

@ -2474,7 +2474,7 @@ static void *statsupdate(void *arg)
ghs1440 = stats.dsps1440 * nonces / bias;
suffix_string(ghs1440, suffix1440, 16, 0);
snprintf(fname, 511, "%s/pool.status", ckp->logdir);
snprintf(fname, 511, "%s/pool/pool.status", ckp->logdir);
fp = fopen(fname, "we");
if (unlikely(!fp))
LOGERR("Failed to fopen %s", fname);
@ -2483,7 +2483,7 @@ static void *statsupdate(void *arg)
"runtime", diff.tv_sec,
"Users", stats.users,
"Workers", stats.workers);
s = json_dumps(val, JSON_NO_UTF8);
s = json_dumps(val, JSON_NO_UTF8 | JSON_PRESERVE_ORDER);
json_decref(val);
LOGNOTICE("Pool:%s", s);
fprintf(fp, "%s\n", s);
@ -2496,7 +2496,7 @@ static void *statsupdate(void *arg)
"hashrate1hr", suffix60,
"hashrate6hr", suffix360,
"hashrate1d", suffix1440);
s = json_dumps(val, JSON_NO_UTF8);
s = json_dumps(val, JSON_NO_UTF8 | JSON_PRESERVE_ORDER);
json_decref(val);
LOGNOTICE("Pool:%s", s);
fprintf(fp, "%s\n", s);
@ -2507,7 +2507,7 @@ static void *statsupdate(void *arg)
"SPS5m", sps5,
"SPS15m", sps15,
"SPS1h", sps60);
s = json_dumps(val, JSON_NO_UTF8);
s = json_dumps(val, JSON_NO_UTF8 | JSON_PRESERVE_ORDER);
json_decref(val);
LOGNOTICE("Pool:%s", s);
fprintf(fp, "%s\n", s);
@ -2558,7 +2558,7 @@ static void *statsupdate(void *arg)
"hashrate1d", suffix1440,
"workers", instance->workers);
snprintf(fname, 511, "%s/%s", ckp->logdir, instance->username);
snprintf(fname, 511, "%s/users/%s", ckp->logdir, instance->username);
fp = fopen(fname, "we");
if (unlikely(!fp)) {
LOGERR("Failed to fopen %s", fname);

Loading…
Cancel
Save