[sysfink] r195 committed - utils ...

0 views
Skip to first unread message

sys...@googlecode.com

unread,
Jan 13, 2010, 5:00:16 PM1/13/10
to sys...@googlegroups.com
Revision: 195
Author: mj41.cz
Date: Wed Jan 13 13:59:42 2010
Log: utils
* new main script is test-new.sh
* add scan-loop.sh test
http://code.google.com/p/sysfink/source/detail?r=195

Added:
/trunk/server/utils/scan-loop.sh
Deleted:
/trunk/server/utils/clear-dev-db.sh
/trunk/server/utils/clear-stable-db.sh
Modified:
/trunk/server/utils/test-new.sh

=======================================
--- /dev/null
+++ /trunk/server/utils/scan-loop.sh Wed Jan 13 13:59:42 2010
@@ -0,0 +1,58 @@
+#!/bin/bash
+
+if [ -z "$2" ]; then
+ echo "Usage:"
+ echo " utils/scan-loop.sh hostname verbosity_level [sleep_time]"
+ echo ""
+ echo " nice -n 10 utils/scan-loop.sh tapir1 3 | tee
temp/scan-loop-out.txt"
+ echo ""
+ exit
+fi
+
+# mandatory
+HOST="$1"
+VER="$2"
+
+# optional
+SLEEP_TIME="$3"
+if [ -z "$SLEEP_TIME" ]; then
+ SLEEP_TIME=30
+fi
+
+
+for ((i=1;1;i++)); do
+ echo "Run number: " $i
+ date
+ echo ""
+
+ echo "Running --cmd=mconf_to_db:"
+ perl sysfink.pl --cmd=mconf_to_db
+ echo ""
+
+ echo "Running --cmd=renew_client_dir"
+ perl sysfink.pl --host=$HOST --cmd=renew_client_dir --ver=$VER
+ echo ""
+
+ echo "Running $HOST 'tmpscan':"
+ perl sysfink.pl --host=$HOST --cmd=scan --section=tmpscan --ver=$VER
+ echo ""
+
+ echo "Running 'diff' on 'tmpscan' section:"
+ perl sysfink.pl --cmd=diff --host=$HOST --section=tmpscan --ver=$VER
+ echo ""
+
+ echo "Running $HOST 'fastscan':"
+ perl sysfink.pl --host=$HOST --cmd=scan --section=fastscan --ver=$VER
+ echo ""
+
+ echo "Running 'diff' on 'fastscan' section:"
+ perl sysfink.pl --cmd=diff --host=$HOST --section=fastscan --ver=$VER
+ echo ""
+
+ echo "Sleeping $SLEEP_TIME s ..."
+ sleep $SLEEP_TIME
+
+ echo ""
+ echo ""
+done
+
=======================================
--- /trunk/server/utils/clear-dev-db.sh Sun Jan 10 15:00:52 2010
+++ /dev/null
@@ -1,35 +0,0 @@
-clear
-
-if [ -z "$1" ]; then
- echo "Help:"
- echo " clear-dev-dh.sh 0 2 ... create fresh dev db, update schema
files"
- exit
-fi
-
-
-if [ "$1" = "0" ]; then
-
- echo "Going to change database to clear version. All data will be
lost."
- echo "Press <Enter> to continue or <Ctrl+C> to cancel ..."
- read
-
- echo "Running utils/all-sql.sh."
- ./utils/all-sql.sh $2
- echo ""
-
- if [ -f "sysfink.db" ]; then
- echo "Removing sysfink.db"
- rm sysfink.db
- fi
-
- echo "Executing temp/schema-raw-create-sqlite.sql (perl
utils/db-run-sqlscript.pl):"
- perl ./utils/db-run-sqlscript.pl temp/schema-raw-create-sqlite.sql 1
-
- echo "Executing sql/data-base.pl."
- perl ./sql/data-base.pl
-
- echo "Executing sql/data-stable.pl."
- perl ./sql/data-dev.pl
-fi
-
-echo "Done."
=======================================
--- /trunk/server/utils/clear-stable-db.sh Sun Jan 10 15:00:52 2010
+++ /dev/null
@@ -1,35 +0,0 @@
-clear
-
-if [ -z "$1" ]; then
- echo "Help:"
- echo " clear-stable-dh.sh 0 2 ... create fresh stable db, update
schema files"
- exit
-fi
-
-
-if [ "$1" = "0" ]; then
-
- echo "Going to change database to clear version. All data will be
lost."
- echo "Press <Enter> to continue or <Ctrl+C> to cancel ..."
- read
-
- echo "Running utils/all-sql.sh."
- ./utils/all-sql.sh $2
- echo ""
-
- if [ -f "sysfink.db" ]; then
- echo "Removing sysfink.db"
- rm sysfink.db
- fi
-
- echo "Executing temp/schema-raw-create-sqlite.sql (perl
utils/db-run-sqlscript.pl):"
- perl ./utils/db-run-sqlscript.pl temp/schema-raw-create-sqlite.sql 1
-
- echo "Executing sql/data-base.pl."
- perl ./sql/data-base.pl
-
- echo "Executing sql/data-stable.pl."
- perl ./sql/data-stable.pl
-fi
-
-echo "Done."
=======================================
--- /trunk/server/utils/test-new.sh Wed Jan 13 12:58:29 2010
+++ /trunk/server/utils/test-new.sh Wed Jan 13 13:59:42 2010
@@ -3,13 +3,15 @@
function echo_help {
cat <<USAGE_END
Usage:
- utils/test-new.sh dev mysql|sqlite hostname.example.com verbosity_level
host_dist_type
- utils/test-new.sh current auto hostname.example.com verbosity_level
host_dist_type
+ utils/test-new.sh dev mysql|sqlite hostname verbosity_level
host_dist_type
+ utils/test-new.sh current auto hostname verbosity_level host_dist_type
+ utils/test-new.sh current_clear auto hostname verbosity_level
host_dist_type

Example:
utils/test-new.sh dev sqlite tapir1 3 linux-perl-md5
utils/test-new.sh dev mysql tapir1 3 linux-perl-md5
utils/test-new.sh current auto tapir1 3 linux-perl-md5
+ utils/test-new.sh current_clear auto tapir1 3 linux-perl-md5

Advanced example:
clear && echo "Running 'dev' and 'current' tests and tee
to 'temp/test-new.out.'" \\
@@ -35,7 +37,9 @@
VER="$4"
DIST_TYPE="$5"

-if [ $TEST_TYPE != "dev" -a $TEST_TYPE != "current" ]; then
+CLEAR=0
+
+if [ $TEST_TYPE != "dev" -a $TEST_TYPE != "current" -a
$TEST_TYPE != "current_clear" ]; then
echo "Error: Unknown test_type '$TEST_TYPE'."
echo ""
echo_help
@@ -50,6 +54,11 @@
exit
fi
else
+ if [ $TEST_TYPE = "current_clear" ]; then
+ TEST_TYPE="current"
+ CLEAR=2
+ fi
+
if [ $DB_TYPE != "auto" ]; then
echo "Error: For test type 'current' only 'auto' db_type allowed."
echo ""
@@ -102,7 +111,7 @@

export SYSFINK_DEVEL=1

- echo "Running utils/all-sql.sh"
+ echo "Running utils/all-sql.sh 1"
./utils/all-sql.sh 1
echo ""

@@ -153,23 +162,11 @@
if [ "$DB_TYPE" = "sqlite" ]; then
if [ ! -f "sysfink.db" ]; then
echo "Current, but sysfink.db not found -> recreating:";
-
- echo "Running utils/all-sql.sh"
- ./utils/all-sql.sh 1
- echo ""
-
- echo "Executing temp/schema-raw-create-sqlite.sql (perl
utils/db-run-sqlscript.pl):"
- perl ./utils/db-run-sqlscript.pl
temp/schema-raw-create-sqlite.sql 1
-
- echo "Executing sql/data-base.pl:"
- perl ./sql/data-base.pl
- echo ""
-
- echo "Executing sql/data-dev.pl:"
- perl ./sql/data-stable.pl
- echo ""
-
- else
+ CLEAR=1
+ fi
+
+ # backup old sqlite db file
+ if [ "$CLEAR" = "0" ]; then
IN_FILE="sysfink.db"
OUT_FILE="temp/$IN_FILE-test.backup"
if [ -f "$IN_FILE" ]; then
@@ -180,6 +177,28 @@
fi
fi

+ if [ "$CLEAR" != "0" ]; then
+ echo "Running utils/all-sql.sh $CLEAR"
+ ./utils/all-sql.sh $CLEAR
+ echo ""
+
+ if [ "$DB_TYPE" = "sqlite" ]; then
+ echo "Executing temp/schema-raw-create-sqlite.sql (perl
utils/db-run-sqlscript.pl):"
+ perl ./utils/db-run-sqlscript.pl
temp/schema-raw-create-sqlite.sql 1
+ else
+ echo "Executing temp/schema.sql (perl
utils/db-run-sqlscript.pl):"
+ perl ./utils/db-run-sqlscript.pl temp/schema.sql 1
+ fi
+
+ echo "Executing sql/data-base.pl:"
+ perl ./sql/data-base.pl
+ echo ""
+
+ echo "Executing sql/data-dev.pl:"
+ perl ./sql/data-stable.pl
+ echo ""
+ fi
+
echo "Running perl sysfink.pl --cmd=mconf_to_db"
perl sysfink.pl --cmd=mconf_to_db
echo ""
@@ -240,6 +259,4 @@
mv "$IN_FILE" "$OUT_FILE" || ( echo "Can't move." && exit )
echo ""
fi
-
fi
-

Reply all
Reply to author
Forward
0 new messages