Always start python via shebang lines.
This is preparation for supporting using Python 3 in production. Signed-off-by: Anders Kaseorg <andersk@mit.edu>
This commit is contained in:
parent
c748962855
commit
fe99695210
|
@ -104,11 +104,11 @@ class IRCBot(irc.bot.SingleServerIRCBot):
|
||||||
return
|
return
|
||||||
self.dcc_connect(address, port)
|
self.dcc_connect(address, port)
|
||||||
|
|
||||||
usage = """python irc-mirror.py --server=IRC_SERVER --channel=<CHANNEL> --nick-prefix=<NICK> [optional args]
|
usage = """./irc-mirror.py --server=IRC_SERVER --channel=<CHANNEL> --nick-prefix=<NICK> [optional args]
|
||||||
|
|
||||||
Example:
|
Example:
|
||||||
|
|
||||||
python irc-mirror.py --irc-server=127.0.0.1 --channel='#test' --nick-prefix=username
|
./irc-mirror.py --irc-server=127.0.0.1 --channel='#test' --nick-prefix=username
|
||||||
--site=https://zulip.example.com --user=irc-bot@example.com
|
--site=https://zulip.example.com --user=irc-bot@example.com
|
||||||
--api-key=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
|
--api-key=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
[program:zmirror-USERNAME]
|
[program:zmirror-USERNAME]
|
||||||
command=python /home/zulip/zulip/bots/zephyr_mirror_backend.py --root-path=/home/zulip/zulip --user=USERNAME --log-path=/home/zulip/logs/mirror-log-%(program_name)s --use-sessions --session-path=/home/zulip/zephyr_sessions/%(program_name)s --api-key-file=/home/zulip/api-keys/%(program_name)s --ignore-expired-tickets --nagios-path=/home/zulip/mirror_status/%(program_name)s --nagios-class=zulip-mirror-nagios
|
command=/home/zulip/zulip/bots/zephyr_mirror_backend.py --root-path=/home/zulip/zulip --user=USERNAME --log-path=/home/zulip/logs/mirror-log-%(program_name)s --use-sessions --session-path=/home/zulip/zephyr_sessions/%(program_name)s --api-key-file=/home/zulip/api-keys/%(program_name)s --ignore-expired-tickets --nagios-path=/home/zulip/mirror_status/%(program_name)s --nagios-class=zulip-mirror-nagios
|
||||||
priority=200 ; the relative start priority (default 999)
|
priority=200 ; the relative start priority (default 999)
|
||||||
autostart=true ; start at supervisord start (default: true)
|
autostart=true ; start at supervisord start (default: true)
|
||||||
autorestart=true ; whether/when to restart (default: unexpected)
|
autorestart=true ; whether/when to restart (default: unexpected)
|
||||||
|
|
|
@ -30,7 +30,7 @@ Here is an example of running the "follow-up" bot from
|
||||||
inside a Zulip repo:
|
inside a Zulip repo:
|
||||||
|
|
||||||
cd ~/zulip/contrib_bots
|
cd ~/zulip/contrib_bots
|
||||||
python run.py lib/followup.py --config-file ~/.zuliprc-prod
|
./run.py lib/followup.py --config-file ~/.zuliprc-prod
|
||||||
|
|
||||||
Once the bot code starts running, you will see a
|
Once the bot code starts running, you will see a
|
||||||
message explaining how to use the bot, as well as
|
message explaining how to use the bot, as well as
|
||||||
|
|
5
contrib_bots/run.py
Normal file → Executable file
5
contrib_bots/run.py
Normal file → Executable file
|
@ -1,3 +1,4 @@
|
||||||
|
#!/usr/bin/env python
|
||||||
from __future__ import print_function
|
from __future__ import print_function
|
||||||
|
|
||||||
import importlib
|
import importlib
|
||||||
|
@ -71,9 +72,9 @@ def run_message_handler_for_bot(lib_module, quiet, config_file):
|
||||||
|
|
||||||
def run():
|
def run():
|
||||||
usage = '''
|
usage = '''
|
||||||
python run.py <lib file>
|
./run.py <lib file>
|
||||||
|
|
||||||
Example: python run.py lib/followup.py
|
Example: ./run.py lib/followup.py
|
||||||
|
|
||||||
(This program loads bot-related code from the
|
(This program loads bot-related code from the
|
||||||
library code and then runs a message loop,
|
library code and then runs a message loop,
|
||||||
|
|
Loading…
Reference in a new issue