Sending message only works if called directly on cli

67 views
Skip to first unread message

Tobi Schindler

unread,
May 2, 2016, 4:02:37 AM5/2/16
to textsecure-go
I have a strange problem with sending messages via textsecure-cmd. I have a simple wrapper script (bash) that uses textsecure to send it's message to my mobile. I want to use it for my monitoring to send alerts.
If I manually fire the wrapper script on the cli, the message arrives on my mobile. If my monitoring software tries to send a message via the wrapper script nothing arrives. I started some debug logging in my wrapper script and it shows that everything should be okay. The textsecure command returns 0. 
There is no issue with the user running the script as I when I manually try it I use the same user as the monitoring software uses.
Is there any explanation why the message only arrives if the wrapper script is fired manually?

Thanks a lot for any idea. If you need more information I will provide it

tobi

Jani Monoses

unread,
May 2, 2016, 7:55:42 AM5/2/16
to Tobi Schindler, textsecure-go
You need to make sure the command is run from a directory where it sees the configuration file just as when you run it manually.

--
You received this message because you are subscribed to the Google Groups "textsecure-go" group.
To unsubscribe from this group and stop receiving emails from it, send an email to textsecure-g...@googlegroups.com.
To post to this group, send email to textse...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/textsecure-go/225f3bd5-2bce-46a4-9a5a-8b7193636a1b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Tobi Schindler

unread,
May 2, 2016, 8:14:51 AM5/2/16
to textsecure-go, tobis...@gmail.com
Am Montag, 2. Mai 2016 13:55:42 UTC+2 schrieb Jani Monoses:
You need to make sure the command is run from a directory where it sees the configuration file just as when you run it manually.

that should not be the issue as my script cd into the correct directory before running the textsecure command. The script sees the .config folder and has access to the .storage.
My wrapper script looks a follows

<<
#!/bin/bash

echo "#### Send $(date)" >>/tmp/textsecure.debug
echo "Recipient $1" >>/tmp/textsecure.debug
#txt=$(printf "$3"|base64)
printf "$3" >>/tmp/textsecure.debug
cd /home/whatsapp/go/textsecure/src/github.com/janimo/textsecure/cmd/textsecure
./textsecure -to='Tobi' -message="$3"
ret=$?
echo "Return value: $ret" >>/tmp/textsecure.debug
echo "#######################" >>/tmp/textsecure.debug
exit $ret
>>

Tobi Schindler

unread,
May 2, 2016, 9:16:25 AM5/2/16
to textsecure-go, tobis...@gmail.com
Hi Jani

was a layer 8 problem :-) I posted the wrong script, the one I devel on but not the one that actually runs. After changing the running script I got return values of 1
I found that although the user running the script has write access on .storage and .config the script returned 1. So I moved all the files/folders to the home dir of the user running the wrapper, changed the path in the script itself (the one it cd to) and after that it worked as it should :-)

Jani Monoses

unread,
May 2, 2016, 9:16:53 AM5/2/16
to Tobi Schindler, textsecure-go
You could try setting the loglevel to debug and check the output of the textsecure command in your debug file by havig it also redirect there.

--
You received this message because you are subscribed to the Google Groups "textsecure-go" group.
To unsubscribe from this group and stop receiving emails from it, send an email to textsecure-g...@googlegroups.com.
To post to this group, send email to textse...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages