rtpub1.sh 304 B

1234567891011
  1. #!/bin/bash
  2. ROOT=$(cd `dirname $0`/../../; pwd)
  3. TOPIC=topic1
  4. URL=http://127.0.0.1:9051/pub?topic=$TOPIC
  5. echo url: $URL
  6. DATE=$(date "+%Y-%m-%d %H:%M:%S").$((`date "+%-N"`/1000000))
  7. echo date: $DATE
  8. MSG="{\"msg\":\"topic1 message\", \"date\":\"$DATE\", \"priority\":1}"
  9. echo MSGS: $MSG
  10. curl -d "$MSG" $URL