Core: How to launch bot?

Created on 30 Mar 2016  路  5Comments  路  Source: php-telegram-bot/core

Sorry for noob question, but how to launch getUpdatesCLI.php script in background (getUpdate installation)?

Most helpful comment

I use this method (by @larknart)

create a daemon configuration script under /etc/init ( NOT /etc/init.d ):-

nano /etc/init/mybot.conf
code sample:-

description "MyBot Daemon"
author "larknart"

start on startup
stop on shutdown
respawn

exec /usr/share/getUpdateCLI.php

alter getUpdateCLI.php:-
below code:

while true; do ./getUpdatesCLI.php; done

add:-

$seconds = 5;
$micro = $seconds * 1000000;

at end of code below:

}
add:-

usleep($micro);
create symbolic link to /usr/share/

ln -s /var/www/html/bot/getUpdateCLI.php /usr/share
after finish all those steps...now you can use " stop mybot | start mybot | status mybot " in terminal then you'll automatically get update.

All 5 comments

I use this method (by @larknart)

create a daemon configuration script under /etc/init ( NOT /etc/init.d ):-

nano /etc/init/mybot.conf
code sample:-

description "MyBot Daemon"
author "larknart"

start on startup
stop on shutdown
respawn

exec /usr/share/getUpdateCLI.php

alter getUpdateCLI.php:-
below code:

while true; do ./getUpdatesCLI.php; done

add:-

$seconds = 5;
$micro = $seconds * 1000000;

at end of code below:

}
add:-

usleep($micro);
create symbolic link to /usr/share/

ln -s /var/www/html/bot/getUpdateCLI.php /usr/share
after finish all those steps...now you can use " stop mybot | start mybot | status mybot " in terminal then you'll automatically get update.

Thanks for sharing! Would be nice to add this example to the wiki!

thx!

I added this example in the wiki

Thanks!

Was this page helpful?
0 / 5 - 0 ratings