unroll [-v] [-h [-f [-t [-a [ filename ]
unroll will print each line from a file filename created with roll on its stdout.
Both programs process all the options given above. Any that do not make sense for the program are not used.
-L
. -h
, -f
, or -t
options are given,
a -h 6 is supplied. This option depends on the line format created by cfht_logv(3)
.
This option is incompatible with -f
and -t
. -h
. -h
. roll
or
unroll
to be roll
. roll
or unroll
to be unroll
.
-f
and -t
options are relatively free format. There is some error
checking, but the aim was to accept pretty much anything without bogging
down in checking for February 30th. Time scanning begins with a default
of the current time as the initial result. Any fields encountered in from
or to are updated in the result. For example, noon will change the time
to 12:00:00 but leave the date alone, PM will make sure the time is in
the afternoon, and yesterday will change the date to yesterday’s date but
leave the time alone. The possible field values include the following. Any alphabetical value given can be abbreviated uniquely. Any combination of case can be used.
- weekday
Sunday
, etc., sets the date to the nearest earlier (including today) day of the week specified. On Wednesday, Wed is today, Tuesday is yesterday, and Th is 6 days ago.- today
- sets the date to today’s date (probably it already was).
- yesterday
- sets the date to yesterday’s date.
- now
- sets the time to now (probably it already was).
- midnight
- sets the time to 00:00:00.
- sunrise
- sets the time to 06:00:00.
- noon
- sets the time to 12:00:00.
- sunset
- sets the time to 18:00:00.
- AM
- is ignored unless the hour is 12, in which case the hour is changed to 0.
- PM
- makes sure the hour is 12 or more.
- hhmm
- sets the time to hh:mm:00.
- h
- where h is not 4 digits long sets the time to h:00:00.
- hh:mm
- sets the time to hh:mm:00.
- hh:mm:ss
- sets the time to hh:mm:ss. Decimal seconds are ignored.
- mm-dd-yy
- sets the date to that given. If yy is not given, the current year is used. If yy is greater than 1900, it is assumed to be a full year specification. "/" can be used instead of "-".
- dd-mmm-yy
- where mmm is alphabetic sets the date to that given, with the same qualifications as for the mm-dd-yy form.
- mmm
- sets the month to that given (why bother? - just to fill out the case :-)
roll -S -p /tmp/pipes/syslog.np &but now that roll detaches from the terminal, it can be started in the foreground, and it will become a daemon process as soon as the roll is set up (which can take a while if syslog.@ needs to be created.) It is also no longer necessary to create /tmp/pipes/syslog.np first. roll will do it if it doesn’t exist (including creating the special directory /tmp/pipes.) So the complete startup recommended for CFHT is now
CFHTLOGU=
CFHTLOGS=/tmp/pipes/syslog.np
export CFHTLOGU CFHTLOGS
/cfht/bin/roll -s 24000000 -p $CFHTLOGS
/cfht/bin/cfht_log reboot START @logging system started by $0@
Possible list requests include the following
The following example will reverse the lines in a small (<1M) file:unroll -h 1
- look at the past hour
unroll -t yes
- look from beginning to this time yesterday
unroll -f @yes suns@ -t mid
- look at yesterday evening
unroll -f mon -t tu
- look from now Monday to now Tuesday
unroll -f 1AM -t 0800
- look from 01:00 to 08:00 today
unroll -f @10-31 mid@ -t @2/nov sunr@
- look from 00:00 31-Oct-?? to 06:00 02-Nov-??
unroll -h 2 -a mos
- look at all mos lines for the last 2 hours
roll -b file.@ <file; unroll file.@ >file.r; rm file.@
Verbose diagnostics include position of end-of-data mark, size of file, type of file (FIFO or LIFO), length and file offsets for each write(s), notification of wrapping past end of file, position of end-of-data mark and file size upon closing of roll file, re-opening of stdin, and notification that a signal was caught causing a closure of the roll file.
The size option will result in a file that will hold size-n bytes, where n is currently 6.
The first
line output from a FIFO file (by unroll
) may not be a complete line.
Eight bit values are allowed with the exception of NULL(0x0) and (0xFF).
When the -h
, -f
, or -t
options are used,
a few extra lines may appear or some expected lines may not appear. This
is because the time comparison is keyed off the (start) lines in the roll
file. They are the only ones with time and date. To see everything in a
LIFO file, use For a FIFO file, use