Commit 15500e94 authored by Erik Alexandre Pucci's avatar Erik Alexandre Pucci

database/tests/multiply_sai_data.sh: Add script to multiply test data

Signed-off-by: default avatarErik Alexandre Pucci <eap08@c3sl.ufpr.br>
parent 77434e53
#!/bin/bash
# Copyright (C) 2009-2012 Centro de Computacao Cientifica e Software Livre
# Departamento de Informatica - Universidade Federal do Parana - C3SL/UFPR
#
# This file is part of database
#
# database 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
# USA.
# This script multiplies the current data inside inventory staging area using a
# new date to reinsert it into sa_inventory
if test $# -ne 2; then
printf "Usage: ./insert_test_school.sh <database> <limit>\n"
exit 1
fi
database=$1
limit=$2
count=0
while test ${count} -lt ${limit}; do
psql -d ${database} -c "insert into sa_inventory (contact_date, project,
inep, machine, os_type, os_distro, kernel, processor, memory_size,
hd_model, hd_size, hd_used, hd2_model, hd2_size, hd2_used, extra_hds)
select contact_date - ${count}, project, inep, machine, os_type,
os_distro, kernel, processor, memory_size, hd_model, hd_size, hd_used,
hd2_model, hd2_size, hd2_used, extra_hds from sa_inventory;"
((count++))
done
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment