Skip to content

[rtkrcv] Hardcoded rtkrcv_<timestamp>.{log,stat,trace} files created in --deamon mode #862

@fwt-dot-fr-gnss

Description

@fwt-dot-fr-gnss

There is no exec >, no > redirection, and no tee anywhere in the launch script.

Root cause

Found in app/consapp/rtkrcv/rtkrcv.c:

#define STATFILE    "rtkrcv_%Y%m%d%h%M.stat"   /* solution status file */
#define TRACEFILE   "rtkrcv_%Y%m%d%h%M.trace"  /* debug trace file */
#define LOGFILE     "rtkrcv_%Y%m%d%h%M.log"    /* Deamon log file */

And later:

static void deamonise(void)
{
    ...
}
...
if (deamon) deamonise();

The deamonise() function unconditionally creates these files when --deamon is set, regardless of .conf settings or command-line flags.

Workarounds

Since filenames and behavior are hardcoded, current options are:

  • Change WorkingDirectory (in systemd or shell) to isolate these files in a dedicated folder
  • Periodic cleanup via cron or logrotate:
  find /path/to/rtklib -maxdepth 1 -name "rtkrcv_*.log" -mtime +7 -delete
  find /path/to/rtklib -maxdepth 1 -name "rtkrcv_*.stat" -mtime +7 -delete
  find /path/to/rtklib -maxdepth 1 -name "rtkrcv_*.trace" -mtime +7 -delete
  • Avoid --deamon — daemonize externally via nohup ... &, setsid, or systemd Type=simple. The hardcoded files are only created in deamon mode.
  • Patch the source — comment out the relevant lines in deamonise() or redirect to /dev/null in a custom build

Suggested improvements

  • Mention these three files in the rtkrcv -h output
  • Allow disabling them entirely (e.g. --deamon-quiet or via .conf option)
  • Make the filenames or output directory configurable (e.g. deamon-logdir, or reuse file-tracefile / file-statfile)
  • Document the behavior in app/consapp/rtkrcv/readme.txt and/or the wiki

Note on the --deamon spelling

For reference: the flag is spelled --deamon, not --daemon. This typo originates from the upstream RTKLIB by T. Takasu and is preserved in demo5 for backward compatibility. Passing --daemon is silently ignored by the argument parser:

else if (!strcmp(argv[i], "--deamon")) deamon=1;

Accepting both spellings as aliases would be a minor but welcome improvement.


Happy to submit a PR for any of the above if there's interest in the direction.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions