On 2019/11/07 12:18, Daniel Colascione wrote: >>> statuses? This information is practically free to collect. >>> >> Because by the time you gather this information, the command has already >> been saved completely. >> >> There have been various proposals to extend the timestamp with additional >> information, but it's all data you can gather when the timestamp is saved >> before the command is executed. >> > Why not also, optionally, save command execution times and exit ---- This sounds like you want accounting info (?). Example: I executed a perl command (using 'tperl') that exited with a status of 12.
The output I got (some spaces trimmed) was: perl |v3| 1.00| 0.00| 1.00| 5013| 201| 11536.00| 0.00| 98283| 98014|12|pts/2 |Sun Nov 10 03:20:17 2019 That could be merged with history output (my HIST format is HISTTIMEFORMAT='%m%d@%H%M%S: ') 55325 1110@032011: tperl exit 12;' 55326 1110@032020: dump-acct -r /var/account/pacct |more 55327 1110@032419: man 5 acct 55328 1110@033045: history |tail -------------------- Documented in manpage 'acct(5)': Fields: #define ACCT_COMM 16 typedef u_int16_t comp_t; struct acct { char ac_flag; /* Accounting flags */ u_int16_t ac_uid; /* Accounting user ID */ u_int16_t ac_gid; /* Accounting group ID */ u_int16_t ac_tty; /* Controlling terminal */ u_int32_t ac_btime; /* Process creation time (seconds since the Epoch) */ comp_t ac_utime; /* User CPU time */ comp_t ac_stime; /* System CPU time */ comp_t ac_etime; /* Elapsed time */ comp_t ac_mem; /* Average memory usage (kB) */ comp_t ac_io; /* Characters transferred (unused) */ comp_t ac_rw; /* Blocks read or written (unused) */ comp_t ac_minflt; /* Minor page faults */ comp_t ac_majflt; /* Major page faults */ comp_t ac_swaps; /* Number of swaps (unused) */ u_int32_t ac_exitcode; /* Process termination status (see wait(2)) */ char ac_comm[ACCT_COMM+1]; /* Command name (basename of last executed command; null-terminated) */ char ac_pad[X]; /* padding bytes */ }; enum { /* Bits that may be set in ac_flag field */ AFORK = 0x01, /* Has executed fork, but no exec */ ASU = 0x02, /* Used superuser privileges */ ACORE = 0x08, /* Dumped core */ AXSIG = 0x10 /* Killed by a signal */ }; The comp_t data type is a floating-point value consisting of a 3-bit, base-8 exponent, and a 13-bit mantissa. A value, c, of this type can be converted to a (long) integer as follows: v = (c & 0x1fff) << (((c >> 13) & 0x7) * 3); The ac_utime, ac_stime, and ac_etime fields measure time in "clock ticks"; divide these values by sysconf(_SC_CLK_TCK) to convert them to seconds.