Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
AossTower
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
MetObs
AossTower
Commits
eec24620
Verified
Commit
eec24620
authored
7 years ago
by
David Hoese
Browse files
Options
Downloads
Patches
Plain Diff
Update loggernet_rotate to be faster
parent
14b1e040
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
scripts/loggernet_rotate.sh
+14
-5
14 additions, 5 deletions
scripts/loggernet_rotate.sh
with
14 additions
and
5 deletions
scripts/loggernet_rotate.sh
+
14
−
5
View file @
eec24620
...
@@ -5,7 +5,7 @@
...
@@ -5,7 +5,7 @@
alias
errcho
=
'>&2 echo'
alias
errcho
=
'>&2 echo'
LOGGERNET_PATH
=
/opt/CampbellSci/LoggerNet
LOGGERNET_PATH
=
/opt/CampbellSci/LoggerNet
LOGGERNET_DATA
=
/data
/loggernet
LOGGERNET_DATA
=
/data
1/incoming/aoss/tower/
#LOGGERNET_DATA=/tmp
#LOGGERNET_DATA=/tmp
HEADER_SIZE
=
0
HEADER_SIZE
=
0
INPUT_PREFIX
=
"rig_tower"
INPUT_PREFIX
=
"rig_tower"
...
@@ -53,10 +53,19 @@ EOF
...
@@ -53,10 +53,19 @@ EOF
# TODO: if file doesn't exist add the header
# TODO: if file doesn't exist add the header
# TODO: Handle output file suffix
# TODO: Handle output file suffix
yyyy_jjj_tower_split
()
{
yyyy_jjj_tower_split
()
{
awk
-F
","
-v
"header_size=
$HEADER_SIZE
"
'NR>header_size { time_spec=sprintf("%04d 01 %03d 00 00 00", $2, $3); print mktime(time_spec) }'
$1
|
\
awk_command
=
'
sort
|
\
NR>header_size {
uniq
|
\
time_spec = sprintf("%04d 01 %03d 00 00 00", $2, $3);
awk
-v
"file_prefix=
$OUTPUT_PREFIX
"
-v
"file_ext=
$OUTPUT_EXT
"
-v
"input_file=
$1
"
'{ file_date=strftime("%Y-%m-%d", $0); jday=strftime("%j", $0); y=strftime("%Y", $0); output_file=sprintf("%s.%s.%s", file_prefix, file_date, file_ext); command=sprintf("grep \"%d,%d\" %s >> %s", y, jday, input_file, output_file); command | getline val; print output_file }'
;
epoch_seconds = mktime(time_spec);
file_date = strftime("%Y-%m-%d", epoch_seconds);
jday = strftime("%j", epoch_seconds);
y = strftime("%Y", epoch_seconds);
output_file = sprintf("%s.%s.%s", file_prefix, file_date, file_ext);
print $0 >> output_file;
print output_file
}
'
awk
-F
","
-v
"header_size=
$HEADER_SIZE
"
-v
"file_prefix=
$OUTPUT_PREFIX
"
-v
"file_ext=
$OUTPUT_EXT
"
"
$awk_command
"
$1
|
uniq
;
}
}
oops
()
{
oops
()
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment