Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F31836769
raw.txt
No One
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Authored By
Kormat
May 22 2020, 9:00 AM
2020-05-22 09:00:45 (UTC+0)
Size
777 B
Referenced Files
None
Subscribers
None
raw.txt
View Options
#!/bin/bash
if [ $# -eq 0 ]; then
echo "Usage:"
echo " ${0##*/} FQDN PORT RACK SECTION [SECTION ..]"
exit 0
fi
fqdn=${1:?}; shift
port=${1:?}; shift
rack=${1:?}; shift
sections="$@"
hostname=${fqdn%%.*}
name=$hostname
[ $port -eq 3306 ] || name=$hostname:$port
dc=$(echo $fqdn | cut -f2 -d.)
set -exu
{
echo "START TRANSACTION;"
echo "INSERT INTO instances (name, server, port) VALUES ('$name', '$fqdn', $port);"
echo "INSERT INTO servers (fqdn, hostname, dc, rack) VALUES ('$fqdn', '$hostname', '$dc', '$rack');"
for i in $sections; do
echo "INSERT INTO section_instances (instance, section) VALUES ('$name', '$i');"
done
echo "COMMIT;"
} | sudo -i mysql.py -BE -h db2093 zarcillo
File Metadata
Details
Attached
Mime Type
text/plain; charset=utf-8
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
8416125
Default Alt Text
raw.txt (777 B)
Attached To
Mode
P11280 zarcillo-add
Attached
Detach File
Event Timeline
Log In to Comment