source: SH_SHM/trunk/source/seed_io/sfd_from_sfdb.csh @ 262

Revision 262, 1.4 KB checked in by marcus, 12 years ago (diff)

r135 | klaus | 2010-08-11 16:18:22 +0200 (Mi, 11 Aug 2010) | 1 line

sfd_from_sfdb for Linux systems

  • Property svn:executable set to *
Line 
1#! /bin/csh
2#
3# file sfd_from_sfdb.csh
4#      =================
5#
6# $Revision: 135 $, $Date: 2010-08-11 16:18:22 +0200 (Mi, 11 Aug 2010) $
7#
8# Create sfdfile (db type) for given time window
9# K. Stammler, 6-Feb-7
10
11if  ("$2" == )  then
12        echo "Usage: $0 <stime> <etime>"
13        exit
14endif
15
16# get parameters
17set starttime=$1
18set endtime=$2
19
20# create sdate & stime for database
21set res=`$SH_UTIL/timename time_to_int $starttime`
22if  ($#res < 7)  then
23        echo "Illegal time format in $starttime."
24        exit
25endif
26@ year = $res[1]
27@ month = $res[2]
28@ day = $res[3]
29@ hour = $res[4]
30@ min = $res[5]
31@ sec = $res[6]
32@ ms = $res[7]
33set sdate=`printf "%4d%02d%02d" $year $month $day`
34set stime=`printf "%02d%02d%02d.%03d" $hour $min $sec $ms`
35set res=`$SH_UTIL/timename time_to_int $endtime`
36if  ($#res < 7)  then
37        echo "Illegal time format in $endtime."
38        exit
39endif
40@ year = $res[1]
41@ month = $res[2]
42@ day = $res[3]
43@ hour = $res[4]
44@ min = $res[5]
45@ sec = $res[6]
46@ ms = $res[7]
47set edate=`printf "%4d%02d%02d" $year $month $day`
48set etime=`printf "%02d%02d%02d.%03d" $hour $min $sec $ms`
49
50if ("`uname`" == "Linux")  then
51    mysql -h $SFDBHOST sfdb -B -e "select * from sftab where ((sdate = $edate and stime <= $etime ) or sdate < $edate) and ((edate = $sdate and etime >= $stime) or edate > $sdate)"
52else
53    $SH_UTIL/sol_sql_call.csh $SFDBHOST "select * from sftab where ((sdate = $edate and stime <= $etime ) or sdate < $edate) and ((edate = $sdate and etime >= $stime) or edate > $sdate)"
54endif
Note: See TracBrowser for help on using the repository browser.