Browse Source

sql - format initid.sh output so it can be sent to ckpmsg

master
kanoi 10 years ago
parent
commit
c5a2737a1f
  1. 17
      sql/initid.sh

17
sql/initid.sh

@ -2,25 +2,10 @@
# #
fldsep="`echo -e '\x09'`" fldsep="`echo -e '\x09'`"
# #
dsp()
{
cut -c4-
# echo
}
process()
{
# <256
len=${#1}
oct="`printf '%03o' "$len"`"
code="`printf "\\\\$oct"`"
all="$code$zero$zero$zero$1"
printf "$code\\0\\0\\000$1" | nc -U -w 1 /opt/ckdb/listener | dsp
}
#
addid() addid()
{ {
msg="newid.$1.idname=$1${fldsep}idvalue=$2" msg="newid.$1.idname=$1${fldsep}idvalue=$2"
process "$msg" echo "$msg"
} }
# #
# Default to yyyymmddXXXXXX # Default to yyyymmddXXXXXX

Loading…
Cancel
Save