Giter VIP home page Giter VIP logo

slinktool's Introduction

slinktool, the all-in-one SeedLink client.

For usage information see the slinktool manual in the 'doc' directory.

Building and Installation

In most environments a simple 'make' will compile the program.

SunOS/Solaris: In order to compile under Solaris the 'src/Makefile' needs to be edited. See the Makefile for instructions.

Windows: A Makefile.win is included for building for using with Nmake, i.e. 'nmake -f Makefile.win'.

For further installation simply copy the resulting binary and man page (in the 'doc' directory) to appropriate system directories.

Licensing

Copyright (C) 2016 Chad Trabant, IRIS Data Management Center

This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version.

This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License (GNU-LGPL) for more details.

You should have received a copy of the GNU Lesser General Public License along with this software. If not, see https://www.gnu.org/licenses/.

slinktool's People

Stargazers

Kevin Jia avatar Hasan E. avatar Rishat Sultanov avatar bbf avatar Brad Avenson avatar  avatar Aleksey Koshkin avatar Francesco Grigoli avatar JuanM Gomez avatar Rafael Ristovski avatar Felix Halpaap avatar 王雨点 avatar Mohammadreza Abdollahzadeh avatar Pierre Gouédard avatar  avatar Angel David Yaguana Hernandez avatar

Watchers

James Cloos avatar Jerome Salichon avatar Adam Clark avatar Dr. Erol Kalkan, P.E. avatar Chad Trabant avatar Kalin Blagoev avatar Pierre Gouédard avatar JuanM Gomez avatar Angel David Yaguana Hernandez avatar  avatar

slinktool's Issues

Compile caveat, remove C99 ‘for’ loop initial declarations

To compile the slinktool in Debian/Ubuntu (only distributions I have tried) I have needed to add CFLAGS="-std=c99" to ezxml/Makefile.

Putting this here in hopes of it being useful to someone in the future / maybe that could be added to the ReadMe install instructions as a 'you may need to do this'.

Segmentation fault with branch 4.4

Trying the new release 4.4 on Debian 11.

I don't go very far:

(gdb) r
Starting program: /home/schaeffj/sources/slinktool-4.4/slinktool -vvv -l /home/schaeffj/work/slinktool_PF -SDS /home/schaeffj/work rtserve.resif.fr
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/usr/lib/libthread_db.so.1".
slinktool version: 4.4
Reading stream list from /home/schaeffj/work/slinktool_PF
Read 2 streams from /home/schaeffj/work/slinktool_PF
verbose:	3
pingonly:	0
'dumpfile' not defined
'archformat' not defined
sdsdir:	/home/schaeffj/work
'buddir' not defined
'statefile' not defined
sladdr:	rtserve.resif.fr
'slconn->begin_time' not defined
'slconn->end_time' not defined
slconn->dialup:	0
slconn->multistation:	1
'slconn->info' not defined
keepalive:	0
nettimeout:	600
netdelay:	30
slconn->protocol_ver:	0.000000
slconn->link:	-1
'streams' array:
Sta - net: PF
Sta - sta: MAID
Sta - selectors: HHZ
Sta - seqnum: -1
'timestamp' not defined
Sta - net: PF
Sta - sta: MAT
Sta - selectors: HHE
Sta - seqnum: -1
'timestamp' not defined
[rtserve.resif.fr] using system socket timeouts
[rtserve.resif.fr] network socket opened
[rtserve.resif.fr] sending: HELLO
[rtserve.resif.fr] connected to: SeedLink v3.1 (2020.075 RingServer) 
[rtserve.resif.fr] capabilities: SLPROTO:3.1 CAP EXTREPLY NSWILDCARD BATCH WS:13
[rtserve.resif.fr] organization: RESIF Ring Server | https://seismology.resif.fr | [email protected]
[rtserve.resif.fr] sending: CAPABILITIES SLPROTO:3.1 CAP EXTREPLY NSWILDCARD BATCH
[rtserve.resif.fr] capabilities OK 
[PF_MAID] sending: STATION MAID PF
[PF_MAID] station is OK 
[PF_MAID] sending: SELECT HHZ
[PF_MAID] selector HHZ is OK {Station specific}
[PF_MAID] 1 selector(s) accepted
[PF_MAID] requesting next available data
[PF_MAID] DATA/FETCH/TIME command is OK 
[PF_MAT] sending: STATION MAT PF
[PF_MAT] station is OK 
[PF_MAT] sending: SELECT HHE
[PF_MAT] selector HHE is OK {Station specific}
[PF_MAT] 1 selector(s) accepted
[PF_MAT] requesting next available data
[PF_MAT] DATA/FETCH/TIME command is OK 
[rtserve.resif.fr] 2 station(s) accepted
[rtserve.resif.fr] sending: END
2023.051.10:51:18.0, seq 10190138, Received Data blockette
error: record header/quality indicator unrecognized: 
Program received signal SIGSEGV, Segmentation fault.
0x0000555555556b21 in ds_streamproc ()
(gdb) bt
#0  0x0000555555556b21 in ds_streamproc ()
#1  0x0000555555557bf2 in sds_streamproc ()
#2  0x00005555555591e9 in packet_handler ()
#3  0x0000555555558b62 in main ()

The content of the selection file is:

PF MAID HHZ
PF MAT HHE

I also tried other networks and I get the same error.

No problem with slinktool 4.3

Is this the primary source for libslink?

Not really an issue, just a question: should this package be considered the main upstream source for libslink? Or is the library developed somewhere else and then just imported here? Thank you.

Managing slinktool's stdout and stderr

Hi,
I'd like to pipe the output of slinktool (stdout and stderr) into syslog, but I don't get all the messages.

I only get messages logged with the function sl_log_r (slconn, ...) but not the messages logged with the finction sl_log(...).

The documentation is clear about the mesage level and verbosity level, still, I miss the logs like "Createing directory ..." from src/dsarchive.c: when piping slinktool's output.

To reproduce:
Whith this command I can see the "Creating directory ..." line

rm -rf 2020 && ./slinktool -v -S FR_ILLK -SDS . rtserve.resif.fr:18000 2>&1

With this command, they are not getting piped, I loose them:

rm -rf 2020 && ./slinktool -v -S FR_ILLK -SDS . rtserve.resif.fr:18000 2>&1 |grep ""

What do I want to accomplish ?
I'd like to add a log on data stream file creation, capture it as an event to do stuff.
I added this line:

modified: src/dsarchive.c
────────────────────────────────────────────
@ src/dsarchive.c:402 @ ds_getstream (DataStream **streamroot, const SLMSrecord *msr,
      sl_log (1, 0, "opening new data stream file, %s\n", strerror (errno));
      return NULL;
    }
    sl_log (0, 0, "New data stream file created: %s\n", filename);

    setvbuf (foundstream->filep, NULL, _IONBF, 0);
  }

I can see the log when running slinktool, but it disapears when I pipe it out.

fix for "too many open files" bug with slinktool-4.3

we have found a problem with slinktool when dealing with a large number of channels with an output in minute-files (-A %...%M). The problem is that the number of open files reaches the limit (1024 is the default for many unices). It is related to the cache management of the output files. I have attached a patch against slinktool-4.3 that fixes the problem (and the modified dsarchive.c).

dsarchive.c is the only affected file, the fix consist of two main changes :
1/ use the MSR time and not the current system time to determine if a entry in the list of datastreams should be closed by the original management of datastreams (checking the oldness of the last access to the datastream)
2/ continuously count the number of open files, if a threshold is reached, then close somes of the oldest datastreams (actually, they are not closed but prepared to be closed by the original management of datastreams by setting the modtime field to 0)

A sample command to reproduce the problem is the following :
slinktool -s "???" rtserve.iris.washington.edu -A "1minute_files/%s%n%l%n-%c-%y%j-%H-%M.mseed" -tw 2020,01,01,00,00,00:
After some (short) time, original slinktool-4.3 does not output data any more but issues the following messages :
opening new data stream file, Too many open files
error: cannot write data to archive

Finally, the interruption of the process (SIGTERM/ctrl-C) leads to a segmentation fault (I did not try to find out where/why).
kind regards
sébastien

patch-and-source.zip

Crash on non-data first record

slinktool v4.3 crashes when archiving data if the first miniSEED record received is not a data packet, for example a 'message' (LOG) packet. slinktool::packet_handler() if(packet_type...) ... else ... does not parse the packet and does not disable archiving for the packet. If this is the very first packet then msr is still NULL but gets passed down into the archiver which attempts to use it. If this is not the first packet, then msr points to non-current informtion.

Suggested change:
if (packet_type == SLDATA)
...
else if (packet_type == SLINF || packet_type == SLINFT)
...
else if (packet_type == SLKEEP)
...
else if (packet_type == SLMSG)
{
sl_log (1, 1, "%s, seq %d, Received %s blockette\n",
timestamp, seqnum, type[packet_type]);
sl_msr_parse (slconn->log, msrecord, &msr, 0, 0);
}

else
{
sl_log (1, 1, "%s, seq %d, Received %s blockette\n",
timestamp, seqnum, type[packet_type]);
archflag = 0;
}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.