#!/bin/bash
ixdate=$(date +%s)
CPUCurFreq=$(xenpm get-cpufreq-states | grep "current frequency")
XENLIST=$(xl list)
mysql -h 172.16.0.3 -u ServerInfo -psosiskasardelka << EOF
INSERT INTO serverInfo.serverBoard ('id', 'name', 'update', 'data') VALUES (NULL, 'cpucurfreq', "$ixdate", "$CPUCurFreq");
INSERT INTO serverInfo.serverBoard ('id', 'name', 'update', 'data') VALUES (NULL, 'xenlist', "$ixdate", "$XENLIST");
EOF
echo $CPUCurFreq
echo $XENLIST
#!/bin/bash
ixdate=$(date +%s)
CPUCurFreq=$(xenpm get-cpufreq-states | grep "current frequency")
XENLIST=$(xl list)
MyUSER="ServerInfo"
MyPASS="sosiskasardelka"
MyHOST="172.16.0.3"
MYSQL="$(which mysql)"
$MYSQL -u $MyUSER -h $MyHOST -p$MyPASS -e "INSERT INTO serverInfo.serverBoard ('id', 'name', 'update', 'data') VALUES (NULL, 'cpucurfreq', "$ixdate", "$CPUCurFreq");"
$MYSQL -u $MyUSER -h $MyHOST -p$MyPASS -e "INSERT INTO serverInfo.serverBoard ('id', 'name', 'update', 'data') VALUES (NULL, 'xenlist', $ixdate, $XENLIST);"
echo $CPUCurFreq
echo $XENLIST
#!/bin/bash
func()
{
local tab date freq
local text
tab=$1
date=$2
freq=$3
text="INSERT INTO $tab ('id', 'name', 'update', 'data')"
text="$text VALUES (NULL, 'cpucurfreq', '$date', '$freq');"
echo "$text"
}
cat -n <<EOF
`func "a" "b b" "c c"`
`func "a" "e e" "f f"`
EOF
exit 0
[guest@localhost sh]$ ./t.sh
1 INSERT INTO a ('id', 'name', 'update', 'data') VALUES (NULL, 'cpucurfreq', 'b b', 'c c');
2 INSERT INTO a ('id', 'name', 'update', 'data') VALUES (NULL, 'cpucurfreq', 'e e', 'f f');
[guest@localhost sh]$