Log Files

Log Files

The standard output from the pre- and post-commands is saved in log files. The location of the log files is determined by the value of the environment variable NC_LOGDIR. If NC_LOGDIR is not set, the files are stored in the directory ./vnc_logs, relative to the current launch directory.

In the following example, NC_LOGDIR is not set, and the run directory is ~/testrundir:
[goetz@goetz1 ~/testrundir]$ pwd
/home/goetz/testrundir
[goetz@goetz1 ~/testrundir]$ ls
vnc_logs
[goetz@goetz1 ~/testrundir]$ ls -a vnc_logs/
. .. 20210726 .precmd.000083865.log .precmd.000083885.log snapshots

The log files are created with zero size if the pre- and post-commands redirect all the output of the files. At the end of the job, if these files are zero length, they are automatically deleted to reduce disk space overhead.

The log files are named according to the following rules:
.precmd.$jobID.log
.postcmd.$jobID.log
The pre- and post-command log files can optionally be located in the same directory as the job log file. For example:
wx run -pre "myprecommand > @JOBLOGDIR@/@JOBID@_pre.out" -l path/to/an/existing/directory/mycommand.out -- mycommand
wx run -post "mypostcommand > @JOBLOGDIR@/@JOBID@_post.out" -l path/to/an/existing/directory/mycommand.out -- mycommand
This would result in the respective pre- and post-command log files being written to the directory path/to/an/existing/directory.
Note: When using the wx run command after forgetting jobs that have pre- and/or post-commands, it does not automatically remove the pre- and post-command .log files. If these files are not zero length, they must be removed manually.