telegram-cli -e disconnects other sessions #341

Closed
ghost opened this Issue Nov 19, 2014 · 13 comments

Projects

None yet

1 participant

@ghost
ghost commented Nov 19, 2014

I have a telegram session running in screen all the time and it shows all the received messages. Now I want to send messages via cron and start a new instance of telegram with "telegram-cli -k tg-server.pub -W -e "msg receiver message". The message is sent to receiver and the new instance exits, but when receiver replies it does not show up in the screen session.

@vysheng
Owner
vysheng commented Nov 19, 2014

You can not run simultaneously two instances with same authorization key

@vysheng
Owner
vysheng commented Nov 19, 2014

It will lead two older instance stop receiving updates. Use two different authorization keys, or use sockets to pass commands two working one

@ghost
ghost commented Nov 20, 2014

So how can I use different auth keys? Is there a way to change config the path to another than ~/.telegram-cli/?
How can I use sockets?

Couldn't find documentation on either of your suggestions..

@ghost
ghost commented Nov 20, 2014

Okay, just found out "telegram-cli -S socketname" creates a file socketname. How can I communicate over that?

@vysheng
Owner
vysheng commented Nov 20, 2014

To communicate through socket you should use same protocol, as to stdin. To have different keys you should use config with different profiles (see config.sample)

@vysheng
Owner
vysheng commented Nov 20, 2014

Like this
echo "msg a_b text" | nc socketname

@ghost
ghost commented Nov 20, 2014

Okay, I think I would prefer the different configs. Can you explain what the parameters test, msg_num and binlog_enabled do?
Thank you :)

@vysheng
Owner
vysheng commented Nov 20, 2014

msg_num - prepend msg_id to message before output
test - use test telegram servers, you don't need it
binlog_enabled - use different storage method. It stores all messages on disk. You probably also don't need it

@ghost
ghost commented Nov 20, 2014

Okay, cool. Just tried it but after typing in the sms code the program quit.

telegram-cli: loop.c:435: write_auth_file: Assertion `auth_file_fd >= 0' failed.
SIGNAL received

Anything else I have to do?

config file looks like this:

default_profile = "test";

cron = {
config_directory = ".telegram/cron";
msg_num = true;
};

test = {
config_directory = ".telegram/test";
msg_num = true;
};

@ghost
ghost commented Nov 20, 2014

Okay, got it. had to use config_directory = ".telegram-cli/test";
Thanks for your help

@ghost
ghost commented Nov 20, 2014

sorry to bother you again... with the default profile it works now, but how do I start the program with another profile? I tried
$ telegram-cli -c cron

but I get "Can not read config 'cron': error 'file I/O error' on the line 0"

@vysheng
Owner
vysheng commented Nov 20, 2014

-p cron

@ghost
ghost commented Nov 20, 2014

thumbs up

@ghost ghost closed this Nov 20, 2014
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment