-
Notifications
You must be signed in to change notification settings - Fork 55
Keep merbot running
merbot
is group administration bot. It's have to stays up 24/7 to service the groups, so the wisest way to deploy merbot
is to deployed it in to a reliable server. How could we keep keep merbot running even after we logout from the server?
Luckily, merbot
have an upstart daemon. So, if your server is Ubuntu or Ubuntu based or whatever distro that support upstart
, you can just execute ./merbot upstart
.
What if upstart
(for whatever reasons) is not possible to be installed in our server?
This page will cover how to run merbot
and keep it running after we logout of the server.
nohup
mean no hang up. nohup
allows you to run merbot
in the background and keep it running by bypasses the signal hang up, making it possible to run merbot
in the background even when the terminal is off.
nohup ./merbot &>/dev/null &
/dev/null
part is to redirect nohup
output to /dev/null
, so it wont create nohup.out
file.
See: Running Bash Commands in the Background the Right Way [Linux]
From terminal multiplexer wiki:
A terminal multiplexer is a software application that can be used to multiplex several virtual consoles, allowing a user to access multiple separate login sessions inside a single terminal window, or detach and reattach sessions from a terminal. It is useful for dealing with multiple programs from a command line interface, and for separating programs from the session of the Unix shell that started the program, particularly so a remote process continues running even when the user is disconnected.
There are two major terminal multplexer in GNU/Linux; tmux
and screen
. The following steps is how to use tmux
(partially taken from an Ask Ubuntu page).
- ssh into the
merbot
server - start
tmux
by typingtmux
into the shell - type
./merbot
inside the started tmux session - leave/detach the
tmux
session by typingCtrl+B
and thenD
You can now safely log off from the merbot
server, merbot
process will keep running inside tmux
. When you come back again and want to check the status of merbot
process you can use tmux attach
to attach to your tmux
session.
If you want to have multiple tmux
sessions running side-by-side, you should name each session using Ctrl-B
and $
. You can get a list of the currently running sessions using tmux list-sessions
.
If you use Ubuntu (based), which is use upstart
as an event-based init daemon, you can create an upstart
script to manage merbot
as a daemon.
./merbot upstart
And then, now you can:
-
sudo start merbot
to start merbots daemon -
sudo stop merbot
to stop merbots daemon -
sudo restart merbot
to restart merbots daemon -
sudo status merbot
to see merbots daemon status
Run upstart without a password
It's tiresome to type a password everytime we're start/stop/restart/status merbot
. It is good practices to passworded sudo, but we know merbot
do no harm. So, it would be better if we can issue merbot
s specific upstart
commands without a password.
Here 's how to set passwordless merbot
s upstart
:
- Type
whoami
to find out your username. For example:iza
- Type
sudo visudo
to editsudoers
file - Append these lines at the end of
sudoers
file:
iza ALL= NOPASSWD: /sbin/start merbot, /sbin/stop merbot, /sbin/restart merbot, /sbin/status merbot
- Save the changes (by
CTRL+O
ifnano
is the editor).
Now, we can sudo start|stop|status|restart merbot
withouth asked for password.
Home
Installation:
Rank system
Frequently Asked Questions
Bugs
Plugins:
- 9gag.lua
- administration.lua
- apod.lua
- bing.lua
- calculator.lua
- cats.lua
- currency.lua
- dilbert.lua
- dogify.lua
- forecast.lua
- gmaps.lua
- gsmarena.lua
- hackernews.lua
- help.lua
- id.lua
- imdb.lua
- isup.lua
- kaskus.lua
- logger.lua
- pattern.lua
- plugins.lua
- quran.lua
- reddit.lua
- rss.lua
- salat.lua
- stats.lua
- sudo.lua
- time.lua
- translate.lua
- urbandictionary.lua
- webshot.lua
- whois.lua
- xkcd.lua
- yify.lua