Replace all !/bin/bash by !/usr/bin/env bash : allow running scripts with bash in non standard path. also on freebsd.

This commit is contained in:
proller 2016-12-21 23:04:27 +03:00
parent 26f5640c2f
commit d270053c3c
54 changed files with 54 additions and 54 deletions

View File

@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
# script to run query to databases
function usage()

View File

@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
QUERIES_FILE="queries.sql"
TABLE=$1

View File

@ -1,3 +1,3 @@
#!/bin/bash
#!/usr/bin/env bash
table=hits_10m; time clickhouse-client --max_bytes_before_external_sort=30000000000 --query="SELECT toInt64(WatchID), JavaEnable, Title, GoodEvent, (EventTime < toDateTime('1971-01-01 00:00:00') ? toDateTime('1971-01-01 00:00:01') : EventTime), (EventDate < toDate('1971-01-01') ? toDate('1971-01-01') : EventDate), CounterID, ClientIP, RegionID, toInt64(UserID), CounterClass, OS, UserAgent, URL, Referer, Refresh, RefererCategoryID, RefererRegionID, URLCategoryID, URLRegionID, ResolutionWidth, ResolutionHeight, ResolutionDepth, FlashMajor, FlashMinor, FlashMinor2, NetMajor, NetMinor, UserAgentMajor, UserAgentMinor, CookieEnable, JavascriptEnable, IsMobile, MobilePhone, MobilePhoneModel, Params, IPNetworkID, TraficSourceID, SearchEngineID, SearchPhrase, AdvEngineID, IsArtifical, WindowClientWidth, WindowClientHeight, ClientTimeZone, (ClientEventTime < toDateTime('1971-01-01 00:00:01') ? toDateTime('1971-01-01 00:00:01') : ClientEventTime), SilverlightVersion1, SilverlightVersion2, SilverlightVersion3, SilverlightVersion4, PageCharset, CodeVersion, IsLink, IsDownload, IsNotBounce, toInt64(FUniqID), OriginalURL, HID, IsOldCounter, IsEvent, IsParameter, DontCountHits, WithHash, HitColor, (LocalEventTime < toDateTime('1971-01-01 00:00:01') ? toDateTime('1971-01-01 00:00:01') : LocalEventTime), Age, Sex, Income, Interests, Robotness, RemoteIP, WindowName, OpenerName, HistoryLength, BrowserLanguage, BrowserCountry, SocialNetwork, SocialAction, HTTPError, SendTiming, DNSTiming, ConnectTiming, ResponseStartTiming, ResponseEndTiming, FetchTiming, SocialSourceNetworkID, SocialSourcePage, ParamPrice, ParamOrderID, ParamCurrency, ParamCurrencyID, OpenstatServiceName, OpenstatCampaignID, OpenstatAdID, OpenstatSourceID, UTMSource, UTMMedium, UTMCampaign, UTMContent, UTMTerm, FromTag, HasGCLID, toInt64(RefererHash), toInt64(URLHash), CLID FROM $table ORDER BY rand()" | corrector_utf8 > /opt/dumps/${table}_corrected.tsv

View File

@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
filename=${1-queries.sql}
table=$2

View File

@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
for table in hits_10m_single hits_100m_single hits_1000m_single; do
clickhouse-client -q "SELECT (round(WatchID/2), JavaEnable, Title, GoodEvent, EventTime, EventDate, CounterID, ClientIP, RegionID,round(UserID/2), CounterClass, OS, UserAgent, URL, Referer, Refresh, RefererCategoryID, RefererRegionID, URLCategoryID, URLRegionID, ResolutionWidth, ResolutionHeight, ResolutionDepth, FlashMajor, FlashMinor, FlashMinor2, NetMajor, NetMinor, UserAgentMajor, CookieEnable, JavascriptEnable, IsMobile, MobilePhone, MobilePhoneModel, Params, IPNetworkID, TraficSourceID, SearchEngineID, SearchPhrase, AdvEngineID, IsArtifical, WindowClientWidth, WindowClientHeight, ClientTimeZone, ClientEventTime, SilverlightVersion1, SilverlightVersion2, SilverlightVersion3, SilverlightVersion4, PageCharset, CodeVersion, IsLink, IsDownload, IsNotBounce,round(FUniqID/2), OriginalURL, HID, IsOldCounter, IsEvent, IsParameter, DontCountHits, WithHash, HitColor, LocalEventTime, Age, Sex, Income, Interests, Robotness, RemoteIP, WindowName, OpenerName, HistoryLength, SocialNetwork, SocialAction, HTTPError, SendTiming, DNSTiming, ConnectTiming, ResponseStartTiming, ResponseEndTiming, FetchTiming, SocialSourceNetworkID, SocialSourcePage, ParamPrice, ParamOrderID, OpenstatServiceName, OpenstatCampaignID, OpenstatAdID, OpenstatSourceID, UTMSource, UTMMedium, UTMCampaign, UTMContent, UTMTerm, FromTag, HasGCLID,round(RefererHash/2),round(URLHash/2), CLID) FROM $table FORMAT CSV" > $table

View File

@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
#!/bin/expect
# Set timeout

View File

@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
#!/bin/expect
# Set timeout

View File

@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
#!/bin/expect
# Set timeout

View File

@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
QUERIES_FILE="queries.sql"
TABLE=$1

View File

@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
#!/bin/expect
# Set timeout

View File

@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
QUERIES_FILE="queries.sql"
TABLE=$1

View File

@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
# См. таску METR-9006
# Удалим increment.txt из StorageMergeTree таблицы и попробуем сделать INSERT в нее. Перезапустим сервер и попробуем сделать INSERT снова.

View File

@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
# METR-9072

View File

@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
echo "DROP DATABASE IF EXISTS final_deleted_test" | clickhouse-client || exit 1
echo "CREATE DATABASE final_deleted_test" | clickhouse-client || exit 2

View File

@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
# См. таску CONV-8849.
# Симулируем ситуацию, когда половина одного файла с засечками не успела записаться на диск

View File

@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
if [ "$1" != '-n' ]
then

View File

@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
# Принимает аргументом директорию с кусками. Постоянно показывает список активных кусков и количество всех кусков.

View File

@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
# MySQL
if [ -z $(which mysqld) ] || [ -z $(which mysqld) ]; then

View File

@ -1,4 +1,4 @@
#!/bin/bash -e
#!/usr/bin/env bash -e
# Скрипт довольно хрупкий.

View File

@ -1,4 +1,4 @@
#!/bin/bash -e
#!/usr/bin/env bash -e
echo "
DROP TABLE IF EXISTS test.two_blocks;

View File

@ -1,3 +1,3 @@
#!/bin/bash -e
#!/usr/bin/env bash -e
for i in {1..10}; do seq 1 100 | sed 's/.*/SELECT count() FROM (SELECT * FROM (SELECT * FROM system.numbers_mt LIMIT 111) LIMIT 55);/' | clickhouse-client -n --receive_timeout=1 --max_block_size=1 | grep -vE '^55$' && echo 'Fail!' && break; echo -n '.'; done; echo

View File

@ -1,3 +1,3 @@
#!/bin/bash -e
#!/usr/bin/env bash -e
for i in {1..10}; do seq 1 100 | sed 's/.*/SELECT * FROM (SELECT * FROM system.numbers_mt LIMIT 111) LIMIT 55;/' | clickhouse-client -n --receive_timeout=1 --max_block_size=1 | wc -l | grep -vE '^5500$' && echo 'Fail!' && break; echo -n '.'; done; echo

View File

@ -1,3 +1,3 @@
#!/bin/bash -e
#!/usr/bin/env bash -e
for i in {1..10}; do seq 1 10 | sed 's/.*/SELECT 1 % ((number + 500) % 1000) FROM system.numbers_mt LIMIT 1000;/' | clickhouse-client -n --receive_timeout=1 --max_block_size=1 >/dev/null 2>&1 && echo 'Fail!' && break; echo -n '.'; done; echo

View File

@ -1,3 +1,3 @@
#!/bin/bash -e
#!/usr/bin/env bash -e
for i in {1..10}; do seq 1 100 | sed 's/.*/SELECT * FROM system.numbers_mt LIMIT 111;/' | clickhouse-client -n --receive_timeout=1 --max_block_size=$(($RANDOM % 123 + 1)) | wc -l | grep -vE '^11100$' && echo 'Fail!' && break; echo -n '.'; done; echo

View File

@ -1,3 +1,3 @@
#!/bin/bash -e
#!/usr/bin/env bash -e
for i in {1..10}; do sleep 0.0$RANDOM; seq 1 100 | sed 's/.*/SELECT 1 % (number - 10000000) FROM system.numbers_mt;/' | clickhouse-client -n --receive_timeout=1 --max_block_size=10 >/dev/null 2>&1 && echo 'Fail!' && break; echo -n '.'; done; echo

View File

@ -1,4 +1,4 @@
#!/bin/bash -e
#!/usr/bin/env bash -e
clickhouse-client -n --query="
DROP TABLE IF EXISTS test.users;

View File

@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
clickhouse-client -n --query="
DROP TABLE IF EXISTS test.numbers_100k;

View File

@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
function create {
clickhouse-client --query="DROP TABLE IF EXISTS test.summing"

View File

@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
curl -sS 'http://localhost:8123/?query=DROP+TABLE' -d 'IF EXISTS test.insert'
curl -sS 'http://localhost:8123/?query=CREATE' -d 'TABLE test.insert (x UInt8) ENGINE = Memory'

View File

@ -1,3 +1,3 @@
#!/bin/bash
#!/usr/bin/env bash
(echo 'SELECT number FROM system.numbers WHERE transform(number, ['; seq 1 100000 | tr '\n' ','; echo '0],['; seq 1 100000 | tr '\n' ','; echo '0]) = 10000000 LIMIT 1';) | clickhouse-client --max_query_size=100000000

View File

@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
curl -sS http://localhost:8123/?extremes=1 -d @- <<< "DROP TABLE IF EXISTS test.test"
curl -sS http://localhost:8123/?extremes=1 -d @- <<< "CREATE TABLE test.test (x UInt8) ENGINE = Log"

View File

@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
curl -vsS http://localhost:8123/?default_format=JSONCompact --data-binary @- <<< "SELECT 1" 2>&1 | grep '< Content-Type';
curl -vsS http://localhost:8123/ --data-binary @- <<< "SELECT 1 FORMAT JSON" 2>&1 | grep '< Content-Type';

View File

@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
clickhouse-client -n --query="
DROP TABLE IF EXISTS test.dst;

View File

@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
clickhouse-client --query="DROP TABLE IF EXISTS test.csv";
clickhouse-client --query="CREATE TABLE test.csv (s String, n UInt64, d Date) ENGINE = Memory";

View File

@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
curl -sS 'http://localhost:8123/?enable_http_compression=1' -d 'SELECT number FROM system.numbers LIMIT 10';
curl -sS 'http://localhost:8123/?enable_http_compression=0' -H 'Accept-Encoding: gzip' -d 'SELECT number FROM system.numbers LIMIT 10';

View File

@ -1,3 +1,3 @@
#!/bin/bash
#!/usr/bin/env bash
echo -ne '1,Hello\n2,World\n' | curl -sSF 'file=@-' 'http://localhost:8123/?query=SELECT+*+FROM+file&file_format=CSV&file_types=UInt8,String';

View File

@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
# При POST можно делать что угодно.
curl -sS "http://localhost:8123/?query=SELECT+*+FROM+system.settings+WHERE+name+IN+('readonly','max_rows_to_read')&max_rows_to_read=10000&default_format=PrettySpaceNoEscapes" -d' '

View File

@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
clickhouse-client --query="DROP TABLE IF EXISTS test.tskv";
clickhouse-client --query="CREATE TABLE test.tskv (tskv_format String, timestamp DateTime, timezone String, text String, binary_data String) ENGINE = Memory";

View File

@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
curl -sS 'http://localhost:8123/?extremes=1&output_format_write_statistics=0' -d "SELECT 1 AS k, count() GROUP BY k WITH TOTALS";
curl -sS 'http://localhost:8123/?extremes=1&output_format_write_statistics=0' -d "SELECT 1234567890123 AS k, count() GROUP BY k WITH TOTALS FORMAT JSON";

View File

@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
echo -ne '\x50\x74\x32\xf2\x59\xe9\x8a\xdb\x37\xc6\x4a\xa7\xfb\x22\xc4\x39''\x82\x13\x00\x00\x00\x09\x00\x00\x00''\x90SELECT 1\n' | curl -sS 'http://localhost:8123/?decompress=1' --data-binary @-
echo -ne 'xxxxxxxxxxxxxxxx''\x82\x13\x00\x00\x00\x09\x00\x00\x00''\x90SELECT 1\n' | curl -sS 'http://localhost:8123/?decompress=1&http_native_compression_disable_checksumming_on_decompress=1' --data-binary @-

View File

@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
echo 'DROP TABLE IF EXISTS test.bom' | curl -sS 'http://localhost:8123/' --data-binary @-
echo 'CREATE TABLE test.bom (a UInt8, b UInt8, c UInt8) ENGINE = Memory' | curl -sS 'http://localhost:8123/' --data-binary @-

View File

@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
curl -sS 'http://localhost:8123/' -d 'SELECT a' | wc -l
curl -sS 'http://localhost:8123/?stacktrace=0' -d 'SELECT a' | wc -l

View File

@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
curl -sS 'http://localhost:8123/' -d 'DROP TABLE IF EXISTS test.bad_arrays'
curl -sS 'http://localhost:8123/' -d 'CREATE TABLE test.bad_arrays (a Array(String)) ENGINE = Memory'

View File

@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
clickhouse-client --query="SELECT 1"
clickhouse-client --query="SELECT 1;"

View File

@ -1,3 +1,3 @@
#!/bin/bash
#!/usr/bin/env bash
clickhouse-client --host=localhost --query="SELECT * FROM ext" --format=Vertical --external --file=- --structure="s String" --name=ext --format=JSONEachRow <<< '{"s":"Hello"}'

View File

@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
curl -vsS 'http://localhost:8123/?add_http_cors_header=1' -H "Origin:smi2.ru" --data-binary @- <<< "SELECT 1" 2>&1 | grep -F "< Access-Control-Allow-Origin: *" | wc -l
curl -vsS 'http://localhost:8123/?add_http_cors_header=0' -H "Origin:smi2.ru" --data-binary @- <<< "SELECT 1" 2>&1 | grep -F "< Access-Control-Allow-Origin: *" | wc -l

View File

@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
clickhouse-client -n --query "DROP TABLE IF EXISTS test.json_noisy; CREATE TABLE test.json_noisy (d1 UInt8, d2 String) ENGINE = Memory"
echo '{"d1" : 1, "d2" : "ok"}

View File

@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
set -e
curl -sS --local-port 1390 'http://localhost:8123?query=SELECT%20port%20FROM%20system.processes%20ORDER%20BY%20elapsed%20LIMIT%201'

View File

@ -1,3 +1,3 @@
#!/bin/bash
#!/usr/bin/env bash
clickhouse-client --multiquery --query="SELECT 1; SELECT xyz; SELECT 2;" 2> /dev/null || true;

View File

@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
set -e
TABLE_HASH="cityHash64(groupArray(cityHash64(*)))"

View File

@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
source "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/get_revision_lib.sh"

View File

@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
# Удаляем из библиотеки объектный файл с лишними символами, которые конфликтуют с имеющимися при статической сборке.

View File

@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
# Добавляет в файрвол правила, не пропускающие пакеты до серверов ZooKeeper.
# Используется для тестирования поведения программ при потере соединения с ZooKeeper.

View File

@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
# Выполняет действия, обратные nozk.sh