-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Proper init script #436
Comments
When installing on centos 6 i noticed i don't have the script start-stop-daemon. Also /lib/init/vars.sh was missing. So, i modified the init.d-script a bit Here it is:
And here is the init.d script:
exit 0 ` This works, i have now 2 servers running this 24/7. Good luck. |
Ok guys,
First off vysheng I really love this this project so I decided to pitch in.
I wrote a proper init script for deamon mode telegram-cli (i hope;) )
There still are some quirks but I can tweak etc all I want but I decided to put it out here so I can get some propper feedback. Seemed more usefull to me.
The script is based for use on raspbian (raspberry pi debian wheezy).
First the files:
/etc/init.d/telegram-cli
/etc/defaults/telegram-cli
:Some notes to get it working correctly (I wrote comments on it in the files themself as best as I could but to be sure):
The idea is the following:
/etc/telegram-cli/server.pub holds your server.pub key for which the program searches on startup. Available in source dir after gt checkout.
/etc/default/telegram-cli holds all the config options. The included sample code is kinda example enough by it's self ;)
/etc/init.d/telegram.cli (the actual init script) Important is to change the "DAEMON=" to the directory you have you're install of the telegram-cli program.
Work in progress is /var/log/telegram-cli.log file. For now I created it by hand an gave it world read write permission till i work out how to properly create one.
Most important is to change the "DAEMON=" parameter in /etc/init.d/telegram-cli file to your installation of telegram-cli program.
It is forced run with username 'pi' for now. This can be any other user kinda depends on under which user you registered telegram-cli under..
To make it run on boot when you are registered do:
it create's a TCP port 1234 to give it commands via netcat or telnet via localhost or other. See: https://github.com/vysheng/tg/wiki/Running-as-daemon scroll to end of the post for an example.
You need to register a different phone number then you own to make LUA scripting work!!! That drove nuts while fucking arround with it. I just registered my parents mobile number cause they do jack shit with their mobile. Let alone telegram ;P
If you want to run it as daemon you need a real homedir/login and run it once interactively to register your number and write the proper ~/.telegram-cli files. You can also copy those files from another user it seems. Up to you :)
Do not ry to backspace or anything it will mostly give you crap. just (country code) + (number) example for NL users: +310612345678 (you can ommit the 0 btw 0 ;) )
This can take some time the first time, so be patient. Register you phone and type the code you get via sms/or phone call.
Then type
And ya are good to go ...
For me this works like a charm.
I would really like to have some feedback on how to make certain things more generic and/or trouble you run into or anything other.
Cheers!
The text was updated successfully, but these errors were encountered: