#!/bin/bash

#*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#+
#+     Internet Radio Automation & Encoding Toolkit
#+
#+     Copyright (C) 2018 - 2026 by Kevin C. O'Kane
#+
#+     Kevin C. O'Kane
#+     kc.okane@gmail.com
#+     https://www.cs.uni.edu/~okane
#+     https://threadsafebooks.com/
#+
#+ This program is free software; you can redistribute it and/or modify
#+ it under the terms of the GNU General Public License as published by
#+ the Free Software Foundation; either version 2 of the License, or
#+ (at your option) any later version.
#+
#+ This program 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 General Public License for more details.
#+
#+ You should have received a copy of the GNU General Public License
#+ along with this program; if not, write to the Free Software
#+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#+
#+ Feb 15, 2026
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

cat /dev/null > nohup.out     # erase any prior nohup.out

date

#-----------------
#       settings
#-----------------

echo

max_docs=$3

starttime.mps

# $2 is the starting sequence number

echo "extractNT $max_docs $2 < input  > db.converted"
extractNT $max_docs $2 < input  > db.converted

rm input

# $1 is the segment number

source ./indexing-controls.script $max_docs $1

# rm -f $DB.stemmed
# rm -f *.txt
# rm -f *.tmp
# rm -f key.dat data.dat

echo "y" | mumps-sql-db-create

echo
echo "Start genome"
echo

# link name used for tracking purposes

ln -s genome genome$1
pwd
genome$1

endtime.mps

