default values: * starttime ($1): 6 month ago if date / gdate works, today otherwise * output file ($2): stdout
		
			
				
	
	
		
			15 lines
		
	
	
		
			523 B
		
	
	
	
		
			Bash
		
	
	
		
			Executable File
		
	
	
	
	
			
		
		
	
	
			15 lines
		
	
	
		
			523 B
		
	
	
	
		
			Bash
		
	
	
		
			Executable File
		
	
	
	
	
#!/bin/bash
 | 
						|
 | 
						|
# get starting date
 | 
						|
# find gdate or date command ( OSX: brew install coreutils)
 | 
						|
# the date command on OSX is not compatible to the linux date command
 | 
						|
datecmd=$((which gdate || which date )| grep bin)
 | 
						|
STIME="${1:-$(${datecmd} -d 6-month-ago +%Y-%m-%d)}"
 | 
						|
STIME="${STIME:-$(date +%Y-%m-%d)}"
 | 
						|
 | 
						|
# get output filename
 | 
						|
OUTPUT="${2:--}"
 | 
						|
 | 
						|
# fetch events
 | 
						|
curl -s -o ${OUTPUT} "https://fdsnws.geophysik.ruhr-uni-bochum.de/fdsnws/event/1/query?starttime=${STIME}&minlat=50.0&maxlat=53.0&minlon=4.0&maxlon=10.0&minmag=0.7"
 |