Open jekl053 opened 9 years ago
probably you named your conf file wrong
I have the same problem. I did it with the wiki instructions and I have two empty files in /etc/telegram-daemon/ :
telegram-daemon.achat.conf telegram-daemon.z5.conf
And then the file /etc/telegram-daemon.achat.conf filled wit this content:
execute telegram-cli
-d
-vvvv
-E
-R
-D
-C
-P 2391
And the contents of /etc/telegram-cli/ are:
server.pub
Contents of /usr/share/telegram-daemon/bin/:
start-telegram-daemon telegram-cli telegram-cli.old
(copied from my compiled /tg/bin/)
At /var/lib/telegram-daemon/ I'm not sure which scripts I should generate and which are generated by telegram... What is with "downloads script-achat.lua script-z5.lua
"?
downloads folder will contain downloads, it is generated automatically. lua scripts are generated by you.
I'm also having the same problem in Debian. I made the configurations step by step correctly, but it does not find this executable . And I see it in the Telegram -cli package:
executable /usr/share/telegram-daemon/bin/msg-search-engine not found
I have also the same issue in Debian
root@telegram:/etc/init.d# ./start-telegram-daemon executable /usr/share/telegram-daemon/bin/msg-search-engine not found root@telegram:/etc/init.d#
vysheng and how do I generate the lua scripts in /var/lib/telegram-daemon/ and the executable /usr/share/telegram-daemon/bin/msg-search-engine ?
Same problem: executable /usr/share/telegram-daemon/bin/msg-search-engine not found
I saw that "msg-search-engine" is called from script https://github.com/vysheng/tg/blob/master/start-telegram-daemon in :
my %Vars = ( "execute" => "msg-search-engine", "work_dir" => "$root/var/lib/telegram-daemon" ); Is a separeted binarie? Where i found it ?
Thanks..
I solved this substituting
my %Vars = ( "execute" => "msg-search-engine", "work_dir" => "$root/var/lib/telegram-daemon" );
with
my %Vars = ( "execute" => "telegram-cli", "work_dir" => "$root/var/lib/telegram-daemon" );
Ciao
Solved !! Timetrave0, your solution worked for me too!
Thanks!
I applied the timetravel0 solution, but after starting the daemon, there is no process running.
Did anyone got it running as daemon?
I made a little workaround to get it working. I wrote my own /etc/init.d/ file and added it into the linux runlevels so I can start the service with "sudo service telegram-daemon start/stop/restart" Here is a sample /etc/init.d/telegram-daemon file: "daemonuser" is the user your standard telegram-cli (set-up in non-daemon mode before!) is running under
#! /bin/sh
### BEGIN INIT INFO
# Provides: telegram-daemon
# Required-Start:
# Required-Stop:
# Default-Start: S 2 3 4 5
# Default-Stop: 0 6
# Short-Description: telegram daemon
# Description: telegram daemon
### END INIT INFO
# Author: fizzzel
# actions
case "$1" in
start)
echo "Telegram daemon is starting..."
su daemonuser -c '/path/to/telegram-cli -vvvvRC -k tg-server.pub -W -dL tg.log -P 1234 &'
echo "...done"
;;
stop)
echo "stopping telegram daemon..."
sudo pkill telegram
echo "..done"
;;
restart)
echo "stopping telegram daemon..."
sudo pkill telegram
echo "..done -- restarting..."
su daemonuser -c '/path/to/telegram-cli -vvvvRC -k tg-server.pub -W -dL tg.log -P 1234 &'
echo "...done"
;;
esac
exit 0
@Fizzzel thank you for your start script, this is the only one i got to work. The other approach is severely broken...
@Fizzzel Thank you for your script, it works fine!
@Fizzzel Why do you use sudo to run telegram-cli as the daemonuser? Why don't you use the -U and -G option of telegram-cli?
Here is my version of the init script, note the -b though if copying, as this is a bot:
#! /bin/sh
### BEGIN INIT INFO
# Provides: telegram-cli
# Required-Start: $network $remote_fs $syslog
# Required-Stop: $network $remote_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Commandline interface for Telegram chat program
# Description: Telegram-cli is a (unofficial) cli version of Telegram to chat from your console.
# This is an init script do make it a daemon.
# When used as daemon in conjuction with LUA (scripting) you can use it to send your system
# commands to execute via other Telegram apps (PC - Phone - Web or other) while not
# logged in to the system.
#
# Note #1: This version of the init script is developed for raspbian (rapberry PI port of Debian Wheezy).
#
#
# See: https://github.com/vysheng/tg for more information.
# Derived from https://github.com/vysheng/tg/issues/436 (updated 9th April 2015)
# Further derived from: https://www.domoticz.com/wiki/Installing_Telegram_Notification_System#.2Fetc.2Finit.d.2Ftelegram-cli
### END INIT INFO
# Set some variables
PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/bin
DESC="Telegram Messaging System"
NAME=telegram-cli
USERNAME=telegramd
GROUPNAME=telegramd
LOGFILE=/var/log/telegramd.log
DAEMON=/usr/bin/telegram-cli
TGPORT=1234
TelegramKeyFile="/etc/telegram-cli/server.pub"
ReceiveLua=/usr/local/lib/tg-handler.lua
DAEMON_ARGS="-W -b -U $USERNAME -G $GROUPNAME -k $TelegramKeyFile -L $LOGFILE -P $TGPORT -s $ReceiveLua -d -vvvRC"
#DAEMON_ARGS="-W -U telegramd -G telegramd -k $TelegramKeyFile -L /var/log/telegramd.log -P $TGPORT -d -vvvRC"
PIDFILE=/var/run/$NAME.pid
SCRIPTNAME=/etc/init.d/$NAME
# Read configuration variable file if it is present
[ -r /etc/default/$NAME ] && . /etc/default/$NAME
# Carry out specific functions when asked to by the system
case "$1" in
start)
echo -n "Starting $DESC ... "
start-stop-daemon --start --background --make-pidfile $PIDFILE --pidfile $PIDFILE \
--exec $DAEMON -- $DAEMON_ARGS || true
echo "Done."
;;
stop)
echo -n "Stopping $DESC ... "
start-stop-daemon --stop --retry 2 --pidfile $PIDFILE \
--exec $DAEMON || true
rm -f $PIDFILE
echo "Done."
;;
restart)
echo -n "Restarting $DESC "
start-stop-daemon --stop --retry 2 --pidfile $PIDFILE \
--exec $DAEMON || true
rm -f $PIDFILE
start-stop-daemon --start --background --make-pidfile $PIDFILE --pidfile $PIDFILE \
--exec $DAEMON -- $DAEMON_ARGS || true
echo "Done."
;;
status)
if [ -f $PIDFILE ]; then
PID=`cat $PIDFILE`
else
echo "No pid file, telegramd not running?"
exit 1
fi
if [ "`ps -p $PID -o comm=`" = "telegram-cli" ]; then
echo "telegramd running with pid $PID"
else
echo "telegramd not running. removing $PIDFILE"
rm -f $PIDFILE
exit 1
fi
;;
*)
N=/etc/init.d/$NAME
echo "Usage $NAME: $SCRIPTNAME {start|stop|restart|status}"
exit 1
;;
esac
@beMoD I wrote my script in 2min, and I was excited that it worked instantly :D If beMoD's script is better, then you're all welcome to use it instead of mine!!!
Ah, i see. Just thought there is a special reason you did it that way, thats why I asked :-)
For me it helped to edit the script /usr/share/telegram-daemon/bin/start-telegram-daemon at the part where it writes the config: ..... binlog_enabled=false; ..... #lua_script=...
Can somebody fix this problem?
Thanks for all the great working, the cli works great!
I tried to run te telegram-cli as daemon on my raspberry pi as described in the wiki page.
When I start the script, I get the following error/output:
/etc/init.d/telegram-daemon start z5 executable /usr/share/telegram-daemon/bin/msg-search-engine not found
Please help :)