GithubHelp home page GithubHelp logo

raphaelcohn / bish-bosh Goto Github PK

View Code? Open in Web Editor NEW
216.0 216.0 37.0 1.38 MB

MQTT shell script client, for bash, dash, BusyBox ash and others. Gives you MQTT on anything Unix like, from embedded routers to AIX servers with almost no dependenices.

Home Page: https://github.com/raphaelcohn/bish-bosh

License: Other

Shell 99.08% Awk 0.92%

bish-bosh's People

Contributors

raphaelcohn avatar xdissent avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

bish-bosh's Issues

prereleased executable doesn't run on OpenWrt

root@eg-018C06:~# sh /tmp/bish-bosh_2015.0119.1445-1_all 
/tmp/bish-bosh_2015.0119.1445-1_all: line 624: syntax error: unexpected "(" (expecting "}")
root@eg-018C06:~# chmod +x /tmp/bish-bosh_2015.0119.1445-1_all
root@eg-018C06:~# /tmp/bish-bosh_2015.0119.1445-1_all 
/tmp/bish-bosh_2015.0119.1445-1_all: line 624: syntax error: unexpected "(" (expecting "}")
root@eg-018C06:~# 

Several issues with latest dep packate in Ubuntu 14.04

Hi,

Just wanted to bring to your attention that the deb package has several problems on Ubuntu 14.04 (probably others too).

After a clean install with dpkg -i

~# bish-bosh -bash: /usr/local/bin/bish-bosh: No such file or directory

But it seems to be installed in /usr/bin/

# which bish-bosh /usr/bin/bish-bosh

Also if run directly from /usr/local/bin/bish-bosh it seems the package missed to create several directories:

# /usr/bin/bish-bosh --verbose 2 -- mqtt_stress.script bish-bosh: FAIL: The defaulted value for '--client-path' specifies a path '/var/lib/bish-bosh/client' which does not exist root@ds-lx-02:~/bish-bosh# mkdir /var/lib/bish-bosh/client mkdir: cannot create directory ‘/var/lib/bish-bosh/client’: No such file or directory root@ds-lx-02:~/bish-bosh# mkdir -p /var/lib/bish-bosh/client root@ds-lx-02:~/bish-bosh# /usr/bin/bish-bosh --verbose 2 -- mqtt_stress.script bish-bosh: FAIL: The defaulted value for '--session-path' specifies a path '/var/spool/bish-bosh/session' which does not exist root@ds-lx-02:~/bish-bosh# mkdir -p /var/spool/bish-bosh/session root@ds-lx-02:~/bish-bosh# /usr/bin/bish-bosh --verbose 2 -- mqtt_stress.script bish-bosh: FAIL: The defaulted value for '--lock-path' specifies a path '/var/run/bish-bosh/lock' which does not exist root@ds-lx-02:~/bish-bosh# mkdir -p /var/run/bish-bosh/lock

And even after creating the above, the script still fails with the following error message:

root@ds-lx-02:~/bish-bosh# /usr/bin/bish-bosh --verbose 2 -- mqtt_stress.script bish-bosh: INFO: Using backend 'ncat' (on path '/usr/bin/ncat') with port '1883' bish-bosh: INFO: Using stdbuf (stdbuf) with od (od) Ncat: Version 6.40 ( http://nmap.org/ncat ) bish-bosh: INFO: Writing CONNECT bish-bosh: NOTICE: Terminate bish-bosh with kill 26017 /usr/bin/bish-bosh: 6399: read: arg count Ncat: Connected to 10.0.0.31:1883. Ncat: 0 bytes sent, 0 bytes received in 0.01 seconds. bish-bosh: FAIL: processLoop failed

Looks like a great piece of software once it's running. Would love to try it out. Looking forward to it.
Any and all assistance is appreciated.

Cheers,
/Stefan

syntax error: Bad substitution when running on BusyBox v1.11.2

Hello,

I'm trying to run bish bosh on an ubiquiti mpower device.

I'm using latest release
BusyBox v1.11.2 (2015-04-06 14:24:36 PDT) built-in shell (ash)
MF.v2.1.11# ./bish-bosh_2015.0629.0920-2_all
./bish-bosh_2015.0629.0920-2_all: line 2890: syntax error: Bad substitution

Do you have any advice?

Thanks a lot.

FAIL: Sent retransmission '' (padded as ' ') already exists for '2' at path ...

Hi !
First of all, great work on Bish-bosh, it is everything I needed for the project I'm working on and works great.
The only problem is the one I'm seeing right now: I run Bish-bosh on a raspberry pi, and as it is far from the wifi access point, it is often subject to deconnections/reconnections.
In order not to miss any messages sent during the time the raspberry wasn't connected to the broker, I use persistent sessions (bishbosh_connect_cleanSession=0).
It works for a bit of time, but at some point, I get the following error and bish-bosh won't reconnect:

Mar 26 09:06:57 adria bish-bosh[1118]: /opt/bish-bosh/bish-bosh: 71: [: -ge: unexpected operator
Mar 26 09:06:57 adria bish-bosh[1118]: /opt/bish-bosh/bish-bosh: 71: [: -ge: unexpected operator
Mar 26 09:06:57 adria bish-bosh[1118]: ln: failed to create symbolic link '/opt/bish-bosh/var/spool/bish-bosh/session/servers/192.168.10.101/ports/1883/client-ids/_adria/retransmission/ /2': File exists
Mar 26 09:06:57 adria bish-bosh[1118]: bish-bosh: FAIL: Sent retransmission '' (padded as ' ') already exists for '2' at path '/opt/bish-bosh/var/spool/bish-bosh/session/servers/192.168.10.101/ports/1883/client-ids/_adria/retransmission/ '.

The only thing to get it working again is change my scriplet, delete the line bishbosh_connect_cleanSession=0, connect again without the persistent session, add the line again and reconnect.

I'm running bish-bosh as a service in order to restart it everytime it loses the connection to the wifi, I don't know if it is a great idea but that's all I could find in order to run the raspberry headless without hogging a terminal.
Here is the configuration:

[Unit]
Description=MQTT Shell Client
[Service]
WorkingDirectory=/opt/bish-bosh/
ExecStart=/opt/bish-bosh/bish-bosh -- /opt/bish-bosh/script
Restart=always
TimeoutStartSec=120
StartLimitIntervalSec=5
StartLimitBurst=2
StandardOutput=syslog
StandardError=syslog
User=root
Group=root
[Install]
WantedBy=network-onlline.target
Alias=bish-bosh.service

Here is my bish-bosh scriplet:

#!/usr/bin/env bish-bosh
bishbosh_connect_cleanSession=0
bishbosh_server="192.168.10.101"
bishbosh_port=1883
bishbosh_clientId="adria"
bishbosh_connect_username=****
bishbosh_connect_password=****
bishbosh_connect_keepAlive=5
bishbosh_connect_willTopic="test/new/"
bishbosh_connect_willMessage="ADRIA : Goodbye Cruel World :("
bishbosh_connect_willQoS=1
bishbosh_connect_willRetain=0
bishbosh_connection_handler_CONNACK()
{
bishbosh_subscribe 'test/new/adria' 1
bishbosh_subscribe 'test/new/' 1
bishbosh_subscribe 'test' 1
bishbosh_publishText 1 'test/new/' no "ADRIA Connected $(date +%d-%m-%Y" "%H:%M:%S)"
}
bishbosh_connection_handler_PUBLISH()
{
date="$(/bin/date +%d-%m-%Y" "%H:%M:%S) :"
message="$(/bin/cat ${messageFilePath})"
echo "${date} Message ${message} Received on Topic ${topicName}" >> /var/log/bish-bosh.log
}

Any idea what might be the problem and how it could be avoided?
Thx in advance!

PS: Another very minor thing: the topic name isn't displayed in my log file when using echo ${topicName}.

Can't publish file, bishbosh_publishFile function not working, too many output retries : Broken pipe

Hello,

The function to publish message via file is not working,
bishbosh_publishFile 0 '/topic/something/0' no 'message' is always throwing an error
Tried different backends, changing read latency, as well as to change file path like './message' '/bish-bosh/message' , './var/run/bish-bosh/lock/servers/...' .'/var/lib/bish-bosh/client/servers/...'
Its almost always the same error :
./bish-bosh: 12: read: arg count
Also tried to change bash to /bin/bash and /bin/sh /usr/bin/env sh
The way i run the program is :
./bish-bosh --verbose 3 -- 'publish-sub.test'

publish-sub.test is not important as it comes up that function doesn't work inside any of handlers as i tried it inmost of them.

I have uploaded relevant logs.
root@571ecc8a8599:/bish-bosh# ./bish-bosh --verbose 3 -- 'publish-sub.test'
bish-bosh: INFO: Using backend 'ncat' (on path '/bin/ncat') with port '3002'
bish-bosh: DEBUG: Passing options to backend 'ncat' using '/bin/ncat' as '-w 30 -v -v URL 3002' (please note spaces ARE handled correctly)
bish-bosh: DEBUG: bishbosh_connection_clientPid is 39981
bish-bosh: INFO: Using stdbuf (stdbuf) with od (od)
bish-bosh: DEBUG: bishbosh_connection_hexConversionPid is 39992
bish-bosh: INFO: Writing CONNECT
bish-bosh: DEBUG: bishbosh_connection_processLoopPid is 39997
Warning: inverse host lookup failed for IP_ADDRESS: No address associated with name
bish-bosh: DEBUG: bishbosh_connection_processingLoopReadInterrupterPid is 40007
bish-bosh: DEBUG: Our Pid is 39649
bish-bosh: NOTICE: Terminate bish-bosh with kill 39649
URL [IP_ADDRESS] 3002 (?) open
bish-bosh: INFO: Received valid CONNACK
./bish-bosh: 12: read: arg count
bish-bosh: FAIL: processLoop failed
root@571ecc8a8599:/bish-bosh# too many output retries : Broken pipe
sent 92, rcvd 4
set-x.log

On the other hand, publishing message as text (bishbosh_PublishText) function is working properly.

Could you please assist or share an example on how to publish message via file.

Additionaly:
error code returned:
echo $?
2
OS : NAME="Ubuntu"
VERSION="16.04.7 LTS (Xenial Xerus)"

sh: printf: I/O error

Hello, i have this issue on Debian 9.
Bish-bosh crashing when receive message in topic.

./bish-bosh --verbose 3 -- /root/bish-bosh/bish-bosh.cfg bish-bosh: INFO: Using backend 'ncDebianTraditional' (on path '/bin/nc') with port '1883' bish-bosh: DEBUG: Passing options to backend 'ncDebianTraditional' using '/bin/nc' as '-w 30 -v -v 192.168.98.5 1883' (please note spaces ARE handled correctly) bish-bosh: DEBUG: bishbosh_connection_clientPid is 10280 bish-bosh: INFO: Using stdbuf (stdbuf) with od (od) bish-bosh: DEBUG: bishbosh_connection_hexConversionPid is 10291 iot [192.168.98.5] 1883 (?) open bish-bosh: INFO: Writing CONNECT bish-bosh: DEBUG: bishbosh_connection_processLoopPid is 10296 bish-bosh: DEBUG: bishbosh_connection_processingLoopReadInterrupterPid is 10306 bish-bosh: DEBUG: Our Pid is 9923 bish-bosh: NOTICE: Terminate bish-bosh with kill 9923 bish-bosh: INFO: Received valid CONNACK bish-bosh: DEBUG: bishbosh_connection_handler_SUBACK(packetIdentifier=1, returnCodeCount=1, returnCodes=0) bish-bosh: DEBUG: bishbosh_connection_handler_noControlPacketsRead() 10 times bish-bosh: DEBUG: bishbosh_connection_handler_noControlPacketsRead() 10 times bish-bosh: DEBUG: bishbosh_connection_handler_noControlPacketsRead() 10 times bish-bosh: DEBUG: bishbosh_connection_handler_noControlPacketsRead() 10 times bish-bosh: DEBUG: bishbosh_connection_handler_noControlPacketsRead() 10 times bish-bosh: DEBUG: bishbosh_connection_handler_noControlPacketsRead() 10 times bish-bosh: DEBUG: bishbosh_connection_handler_noControlPacketsRead() 10 times sent 414, rcvd 49 bish-bosh: DEBUG: bishbosh_connection_handler_noControlPacketsRead() 10 times bish-bosh: DEBUG: bishbosh_connection_handler_noControlPacketsRead() 10 times bish-bosh: DEBUG: bishbosh_connection_handler_noControlPacketsRead() 10 times bish-bosh: DEBUG: bishbosh_connection_handler_noControlPacketsRead() 10 times bish-bosh: DEBUG: bishbosh_connection_handler_noControlPacketsRead() 10 times root@iot:~/bish-bosh# bish-bosh: INFO: processLoop terminating because of signal bish-bosh: DEBUG: bishbosh_connection_handler_noControlPacketsRead() 10 times bish-bosh: INFO: Writing DISCONNECT

If i comment out bishbosh_connection_handler_PUBLISH(), then i see messages received.

bish-bosh: DEBUG: bishbosh_connection_handler_PUBLISH(packetIdentifier=qos0, retain=0, QoS=0, dup=0, topicLength=15, topicName=, topicNameFilePath=/tmp/bish-bosh.u0sYp8RL8Imu/session/our-packet-identifiers/qos0/topic-name, messageLength=1, messageFilePath=/tmp/bish-bosh.u0sYp8RL8Imu/session/our-packet-identifiers/qos0/message-received)

BusyBox error "shellfire/core/init.functions: line 1: command: not found"

I'm trying to run bish-bosh on BusyBox v1.25.0.git (2016-02-25 12:24:31 CET) built-in shell (ash) which sadly doesn't work.

Latest release doesn't run due to issue #6 so I checked out latest commit 2aff96f
(side note: I don't have git on that BusyBox computer, so I used cygwin to checkout (and submodule init) it on a windows computer, and used WinSCP to copy resulting directory to BusyBox machine; checkout with windows destroys line endings)

With that I get that errors:

# ./bish-bosh --client-id 12 --verbose 2
bish-bosh: WARN: Your shell doesn't have RANDOM, and mktemp isn't available. - we're creating temporary files beneath your HOME at '/data/bish-bosh/2606'
./bish-bosh: ./lib/shellfire/core/init.functions: line 1: command: not found
./bish-bosh: ./lib/shellfire/core/init.functions: line 1: command: not found
./bish-bosh: ./lib/shellfire/core/init.functions: line 1: command: not found
./bish-bosh: eval: line 1: syntax error: bad function name

Full output from first warning to last error with set -x in bish-bosh:

+ printf %s%s%s\n  bish-bosh: WARN: Your shell doesn't have RANDOM, and mktemp isn't available. - we're creating temporary files beneath your HOME at '/data/bish-bosh/2354'
bish-bosh: WARN: Your shell doesn't have RANDOM, and mktemp isn't available. - we're creating temporary files beneath your HOME at '/data/bish-bosh/2354'
+ rm -rf /data/bish-bosh/2354
+ mkdir -m 0700 /data/bish-bosh/2354
+ core_variable_array_append _core_temporaryFiles_filesToRemoveOnExit /data/bish-bosh/2354
+ local variableName=_core_temporaryFiles_filesToRemoveOnExit
+ shift 1
+ local argument
+ core_variable_array_isUnset _core_temporaryFiles_filesToRemoveOnExit
+ core_variable_array_isSet _core_temporaryFiles_filesToRemoveOnExit
+ local variableName=_core_temporaryFiles_filesToRemoveOnExit
+ local variableNameInitialised=_core_temporaryFiles_filesToRemoveOnExit_initialised
+ core_variable_isSet _core_temporaryFiles_filesToRemoveOnExit_initialised
+ local x
+ eval x="${_core_temporaryFiles_filesToRemoveOnExit_initialised+set}"
+ x=
+ [  = set ]
+ return 1
+ core_variable_array_initialise _core_temporaryFiles_filesToRemoveOnExit
+ local variableName=_core_temporaryFiles_filesToRemoveOnExit
+ local variableNameInitialised=_core_temporaryFiles_filesToRemoveOnExit_initialised
+ core_variable_isSet _core_temporaryFiles_filesToRemoveOnExit_initialised
+ local x
+ eval x="${_core_temporaryFiles_filesToRemoveOnExit_initialised+set}"
+ x=
+ [  = set ]
+ core_variable_setVariable _core_temporaryFiles_filesToRemoveOnExit
+ eval _core_temporaryFiles_filesToRemoveOnExit=$2
+ _core_temporaryFiles_filesToRemoveOnExit=
+ core_variable_setVariable _core_temporaryFiles_filesToRemoveOnExit_initialised 0
+ eval _core_temporaryFiles_filesToRemoveOnExit_initialised=$2
+ _core_temporaryFiles_filesToRemoveOnExit_initialised=0
+ core_variable_setVariable _core_temporaryFiles_filesToRemoveOnExit /data/bish-bosh/2354
+ eval _core_temporaryFiles_filesToRemoveOnExit=$2
+ _core_temporaryFiles_filesToRemoveOnExit=/data/bish-bosh/2354
+ core_variable_setVariable _core_temporaryFiles_filesToRemoveOnExit_initialised 1
+ eval _core_temporaryFiles_filesToRemoveOnExit_initialised=$2
+ _core_temporaryFiles_filesToRemoveOnExit_initialised=1
+ _core_temporaryFiles_fileCounter=0
+ _core_temporaryFiles_folderCounter=0
+ return 0
+ IFS=

+ core_children_initialise --client-id 12 --verbose 2
+ core_trap_addOnCleanUp core_children_killAll
+ core_trap_addHandler core_children_killAll EXIT INT TERM ABRT QUIT
+ local handler=core_children_killAll
+ shift 1
+ local trapName
+ :
+ :
+ :
+ :
+ :
+ core_variable_array_append core_trap_handlers_EXIT core_children_killAll
+ local variableName=core_trap_handlers_EXIT
+ shift 1
+ local argument
+ core_variable_array_isUnset core_trap_handlers_EXIT
+ core_variable_array_isSet core_trap_handlers_EXIT
+ local variableName=core_trap_handlers_EXIT
+ local variableNameInitialised=core_trap_handlers_EXIT_initialised
+ core_variable_isSet core_trap_handlers_EXIT_initialised
+ local x
+ eval x="${core_trap_handlers_EXIT_initialised+set}"
+ x=set
+ [ set = set ]
+ local core_variable_indirectValue_result
+ core_variable_indirectValue core_trap_handlers_EXIT_initialised
+ eval core_variable_indirectValue_result="$core_trap_handlers_EXIT_initialised"
+ core_variable_indirectValue_result=1
+ [ 1 -gt 0 ]
+ return 0
+ core_variable_indirectValue core_trap_handlers_EXIT_initialised
+ eval core_variable_indirectValue_result="$core_trap_handlers_EXIT_initialised"
+ core_variable_indirectValue_result=1
+ core_variable_setVariable core_trap_handlers_EXIT_initialised 2
+ eval core_trap_handlers_EXIT_initialised=$2
+ core_trap_handlers_EXIT_initialised=2
+ core_variable_indirectValue core_trap_handlers_EXIT
+ eval core_variable_indirectValue_result="$core_trap_handlers_EXIT"
+ core_variable_indirectValue_result=core_temporaryFiles_removeAll
core_children_killAllriable core_trap_handlers_EXIT core_temporaryFiles_removeAll
+ eval core_trap_handlers_EXIT=$2
core_children_killAllEXIT=core_temporaryFiles_removeAll
+ core_variable_array_append core_trap_handlers_INT core_children_killAll
+ local variableName=core_trap_handlers_INT
+ shift 1
+ local argument
+ core_variable_array_isUnset core_trap_handlers_INT
+ core_variable_array_isSet core_trap_handlers_INT
+ local variableName=core_trap_handlers_INT
+ local variableNameInitialised=core_trap_handlers_INT_initialised
+ core_variable_isSet core_trap_handlers_INT_initialised
+ local x
+ eval x="${core_trap_handlers_INT_initialised+set}"
+ x=set
+ [ set = set ]
+ local core_variable_indirectValue_result
+ core_variable_indirectValue core_trap_handlers_INT_initialised
+ eval core_variable_indirectValue_result="$core_trap_handlers_INT_initialised"
+ core_variable_indirectValue_result=1
+ [ 1 -gt 0 ]
+ return 0
+ core_variable_indirectValue core_trap_handlers_INT_initialised
+ eval core_variable_indirectValue_result="$core_trap_handlers_INT_initialised"
+ core_variable_indirectValue_result=1
+ core_variable_setVariable core_trap_handlers_INT_initialised 2
+ eval core_trap_handlers_INT_initialised=$2
+ core_trap_handlers_INT_initialised=2
+ core_variable_indirectValue core_trap_handlers_INT
+ eval core_variable_indirectValue_result="$core_trap_handlers_INT"
+ core_variable_indirectValue_result=core_temporaryFiles_removeAll
core_children_killAllriable core_trap_handlers_INT core_temporaryFiles_removeAll
+ eval core_trap_handlers_INT=$2
core_children_killAllINT=core_temporaryFiles_removeAll
+ core_variable_array_append core_trap_handlers_TERM core_children_killAll
+ local variableName=core_trap_handlers_TERM
+ shift 1
+ local argument
+ core_variable_array_isUnset core_trap_handlers_TERM
+ core_variable_array_isSet core_trap_handlers_TERM
+ local variableName=core_trap_handlers_TERM
+ local variableNameInitialised=core_trap_handlers_TERM_initialised
+ core_variable_isSet core_trap_handlers_TERM_initialised
+ local x
+ eval x="${core_trap_handlers_TERM_initialised+set}"
+ x=set
+ [ set = set ]
+ local core_variable_indirectValue_result
+ core_variable_indirectValue core_trap_handlers_TERM_initialised
+ eval core_variable_indirectValue_result="$core_trap_handlers_TERM_initialised"
+ core_variable_indirectValue_result=1
+ [ 1 -gt 0 ]
+ return 0
+ core_variable_indirectValue core_trap_handlers_TERM_initialised
+ eval core_variable_indirectValue_result="$core_trap_handlers_TERM_initialised"
+ core_variable_indirectValue_result=1
+ core_variable_setVariable core_trap_handlers_TERM_initialised 2
+ eval core_trap_handlers_TERM_initialised=$2
+ core_trap_handlers_TERM_initialised=2
+ core_variable_indirectValue core_trap_handlers_TERM
+ eval core_variable_indirectValue_result="$core_trap_handlers_TERM"
+ core_variable_indirectValue_result=core_temporaryFiles_removeAll
core_children_killAllriable core_trap_handlers_TERM core_temporaryFiles_removeAll
+ eval core_trap_handlers_TERM=$2
core_children_killAllTERM=core_temporaryFiles_removeAll
+ core_variable_array_append core_trap_handlers_ABRT core_children_killAll
+ local variableName=core_trap_handlers_ABRT
+ shift 1
+ local argument
+ core_variable_array_isUnset core_trap_handlers_ABRT
+ core_variable_array_isSet core_trap_handlers_ABRT
+ local variableName=core_trap_handlers_ABRT
+ local variableNameInitialised=core_trap_handlers_ABRT_initialised
+ core_variable_isSet core_trap_handlers_ABRT_initialised
+ local x
+ eval x="${core_trap_handlers_ABRT_initialised+set}"
+ x=set
+ [ set = set ]
+ local core_variable_indirectValue_result
+ core_variable_indirectValue core_trap_handlers_ABRT_initialised
+ eval core_variable_indirectValue_result="$core_trap_handlers_ABRT_initialised"
+ core_variable_indirectValue_result=1
+ [ 1 -gt 0 ]
+ return 0
+ core_variable_indirectValue core_trap_handlers_ABRT_initialised
+ eval core_variable_indirectValue_result="$core_trap_handlers_ABRT_initialised"
+ core_variable_indirectValue_result=1
+ core_variable_setVariable core_trap_handlers_ABRT_initialised 2
+ eval core_trap_handlers_ABRT_initialised=$2
+ core_trap_handlers_ABRT_initialised=2
+ core_variable_indirectValue core_trap_handlers_ABRT
+ eval core_variable_indirectValue_result="$core_trap_handlers_ABRT"
+ core_variable_indirectValue_result=core_temporaryFiles_removeAll
core_children_killAllriable core_trap_handlers_ABRT core_temporaryFiles_removeAll
+ eval core_trap_handlers_ABRT=$2
core_children_killAllABRT=core_temporaryFiles_removeAll
+ core_variable_array_append core_trap_handlers_QUIT core_children_killAll
+ local variableName=core_trap_handlers_QUIT
+ shift 1
+ local argument
+ core_variable_array_isUnset core_trap_handlers_QUIT
+ core_variable_array_isSet core_trap_handlers_QUIT
+ local variableName=core_trap_handlers_QUIT
+ local variableNameInitialised=core_trap_handlers_QUIT_initialised
+ core_variable_isSet core_trap_handlers_QUIT_initialised
+ local x
+ eval x="${core_trap_handlers_QUIT_initialised+set}"
+ x=set
+ [ set = set ]
+ local core_variable_indirectValue_result
+ core_variable_indirectValue core_trap_handlers_QUIT_initialised
+ eval core_variable_indirectValue_result="$core_trap_handlers_QUIT_initialised"
+ core_variable_indirectValue_result=1
+ [ 1 -gt 0 ]
+ return 0
+ core_variable_indirectValue core_trap_handlers_QUIT_initialised
+ eval core_variable_indirectValue_result="$core_trap_handlers_QUIT_initialised"
+ core_variable_indirectValue_result=1
+ core_variable_setVariable core_trap_handlers_QUIT_initialised 2
+ eval core_trap_handlers_QUIT_initialised=$2
+ core_trap_handlers_QUIT_initialised=2
+ core_variable_indirectValue core_trap_handlers_QUIT
+ eval core_variable_indirectValue_result="$core_trap_handlers_QUIT"
+ core_variable_indirectValue_result=core_temporaryFiles_removeAll
core_children_killAllriable core_trap_handlers_QUIT core_temporaryFiles_removeAll
+ eval core_trap_handlers_QUIT=$2
core_children_killAllQUIT=core_temporaryFiles_removeAll
+ IFS=

+ core_compatibility_execute --client-id 12 --verbose 2
+ core_functions_execute _core_compatibility_functions
+ local functionsVariableName=_core_compatibility_functions
+ shift 1
+ core_variable_isSet _core_compatibility_functions
+ local x
+ eval x="${_core_compatibility_functions+set}"
+ x=set
+ [ set = set ]
+ core_variable_array_iterateAsCallbacks _core_compatibility_functions
+ local variableName=_core_compatibility_functions
+ shift 1
+ _core_variable_array_isEmpty
+ local core_variable_indirectValue_result
+ core_variable_indirectValue _core_compatibility_functions_initialised
+ eval core_variable_indirectValue_result="$_core_compatibility_functions_initialised"
+ core_variable_indirectValue_result=3
+ [ 3 -eq 0 ]
+ local core_variable_indirectValue_result
+ core_variable_indirectValue _core_compatibility_functions
+ eval core_variable_indirectValue_result="$_core_compatibility_functions"
core_compability_installSourcendPopd=core_compatibility_setSaneShellOptions
+ local originalIFS=

+ local IFS=
+ local callback
+ IFS=

+ core_compatibility_setSaneShellOptions
+ :
+ IFS=

+ core_compability_installPushdAndPopd
+ _core_compatibility_builtInDoesNotExist pushd
+ local builtInName=pushd
+ PATH= core_compatibility_which pushd
+ command -v pushd
./bish-bosh: ./lib/shellfire/core/init.functions: line 1: command: not found
+ local value=
+ [ pushd =  ]
+ return 0
+ _core_compatibility_builtInDoesNotExist popd
+ local builtInName=popd
+ PATH= core_compatibility_which popd
+ command -v popd
./bish-bosh: ./lib/shellfire/core/init.functions: line 1: command: not found
+ local value=
+ [ popd =  ]
+ return 0
+ _core_init_compatibility_pushdCount=0
+ IFS=

+ core_compability_installSource
+ _core_compatibility_builtInDoesNotExist source
+ local builtInName=source
+ PATH= core_compatibility_which source
+ command -v source
./bish-bosh: ./lib/shellfire/core/init.functions: line 1: command: not found
+ local value=
+ [ source =  ]
+ return 0
+ eval source()
{
. "$@"
}
./bish-bosh: eval: line 1: syntax error: bad function name
+ _core_trap_executeOnTrap EXIT
+ local trapName=EXIT
+ local arrayName=core_trap_handlers_EXIT
+ core_variable_array_isUnset core_trap_handlers_EXIT
+ core_variable_array_isSet core_trap_handlers_EXIT
+ local variableName=core_trap_handlers_EXIT
+ local variableNameInitialised=core_trap_handlers_EXIT_initialised
+ core_variable_isSet core_trap_handlers_EXIT_initialised
+ local x
+ eval x="${core_trap_handlers_EXIT_initialised+set}"
+ x=set
+ [ set = set ]
+ local core_variable_indirectValue_result
+ core_variable_indirectValue core_trap_handlers_EXIT_initialised
+ eval core_variable_indirectValue_result="$core_trap_handlers_EXIT_initialised"
+ core_variable_indirectValue_result=2
+ [ 2 -gt 0 ]
+ return 0
+ core_variable_array_iterateAsCallbacks core_trap_handlers_EXIT
+ local variableName=core_trap_handlers_EXIT
+ shift 1
+ _core_variable_array_isEmpty
+ local core_variable_indirectValue_result
+ core_variable_indirectValue core_trap_handlers_EXIT_initialised
+ eval core_variable_indirectValue_result="$core_trap_handlers_EXIT_initialised"
+ core_variable_indirectValue_result=2
+ [ 2 -eq 0 ]
+ local core_variable_indirectValue_result
+ core_variable_indirectValue core_trap_handlers_EXIT
+ eval core_variable_indirectValue_result="$core_trap_handlers_EXIT"
core_children_killAllectValue_result=core_temporaryFiles_removeAll
+ local originalIFS=

bishbosh_publishFile fails on Busybox ash (openwrt)

$2 doesn't get set which causes an unkown operand error and then:
./bish-bosh: ./lib/shellfire/core/init.functions: line 1: 2: parameter not set when calling dd in

bishbosh_connection_write_file()
     {
              dd if="$1" bs=$2 count=1
     }

root cause is bishbosh_filesize_ls() returning empty.

bishbosh_filesize_ls()
{
	# dateBitsAndFileName are not portable
	# permissions may have a '@' on the end if it is Mac OS X ls	
	local permissions links uid gid size dateBitsAndFileName

	IFS=' ' read -r <<-EOF
		$(ls -L -l -n "$1")
	EOF
}

workaround: use stat --filesize-algorithm GNUAndBusyBoxStat (or don't use dd )

get the following error message

after running
./bish-bosh --verbose 2 -- /tmp/bish-bosh.example

I get
bish-bosh: INFO: Using backend 'socat' (on path '/usr/bin/socat') with port '1883'
./bish-bosh: 234: ./lib/shellfire/core/init.functions: binding: parameter not set

running on a raspberry pi with latest release of jessie

clientid_prefixes support?

Does bish-bosh support/implement something like clientid_prefixes? The conceptual idea is to connect to test.mosquitto.org on port 8883 (TLS) and use this feature to limit pubsub communication to a limited set of computers that share this (presumably long and randomized) shared "secret". Essentially, a poor-man's less-secure version of PSK...

Error while sending message with Raspberry Pi

I tried to execute the following test code on my raspberry pi:

bishbosh_clientId=12

bishbosh_connection_handler_CONNACK()
{
    # Set up some subscriptions... another implementation could read from a standard file
    bishbosh_subscribe \
        '/topic/qos/0' 0 \
        '/topic/qos/1' 1 \
        '/topic/qos/3' 1

    bishbosh_unsubscribe \
        '/topic/not/wanted' \
        '/and/also/topic/not/wanted'

    # Publish a QoS 0 message
    # On topic a/b
    # Unretained
    # With value 'X'
    bishbosh_publishText 0 'a/b' no 'My message'
    #bishbosh_publishFile 1 'a/b' no '/tmp/test.dat'
}

bishbosh_connection_handler_PUBLISH()
{
    echo "Message received: retain=$retain, QoS=$QoS, dup=$dup, topicLength=$topicLength, topicName=$topicName, messageLength=$messageLength, messageFilePath=$messageFilePath"
}

bishbosh_connection_handler_noControlPacketsRead()
{
    # This event happens every few milliseconds - use this to publish some messages, change subscriptions or reload our configuration. Perhaps we could monitor a folder path?
    # bishbosh_publishText 0 'nowt' no 'hello world'
    echo 'No Control Packages Read' 1>&2
}

And get the following error. This is caused by bishbosh_publishText. Is there a mistake I don't see?

pi@raspberrypi ~ $  sudo ./mqtt/bish-bosh/bish-bosh --verbose 10 -- /tmp/bish-bosh.example
bish-bosh: INFO: Using backend 'ncat' (on path '/usr/bin/ncat') with port '1883'
bish-bosh: DEBUG: Passing options to backend 'ncat' using '/usr/bin/ncat' as '-w 30 -v -v test.mosquitto.org 1883' (please note spaces ARE handled correctly)
bish-bosh: DEBUG: bishbosh_connection_clientPid is 20555
bish-bosh: INFO: Using stdbuf (stdbuf) with od (od)
bish-bosh: DEBUG: bishbosh_connection_hexConversionPid is 20566
Ncat: bish-bosh: INFO: Writing CONNECT
Version 6.00 ( http://nmap.org/ncat )
bish-bosh: DEBUG: bishbosh_connection_processLoopPid is 20571
bish-bosh: DEBUG: bishbosh_connection_processingLoopReadInterrupterPid is 20582
bish-bosh: DEBUG: Our Pid is 20275
bish-bosh: NOTICE: Terminate bish-bosh with  kill 20275
Ncat: Connected to 85.119.83.194:1883.
./mqtt/bish-bosh/bish-bosh: 1: eval: message: parameter not set
bish-bosh: FAIL: processLoop failed

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.