From fe996952102b9b4ade4e3eebd93f381c1a2de213 Mon Sep 17 00:00:00 2001 From: Anders Kaseorg Date: Mon, 21 Nov 2016 19:44:16 -0500 Subject: [PATCH] Always start python via shebang lines. This is preparation for supporting using Python 3 in production. Signed-off-by: Anders Kaseorg --- bots/irc-mirror.py | 4 ++-- bots/zmirror_private.conf.template | 2 +- contrib_bots/lib/readme.md | 2 +- contrib_bots/run.py | 5 +++-- 4 files changed, 7 insertions(+), 6 deletions(-) mode change 100644 => 100755 contrib_bots/run.py diff --git a/bots/irc-mirror.py b/bots/irc-mirror.py index 8f058b0..f9af690 100755 --- a/bots/irc-mirror.py +++ b/bots/irc-mirror.py @@ -104,11 +104,11 @@ class IRCBot(irc.bot.SingleServerIRCBot): return self.dcc_connect(address, port) -usage = """python irc-mirror.py --server=IRC_SERVER --channel= --nick-prefix= [optional args] +usage = """./irc-mirror.py --server=IRC_SERVER --channel= --nick-prefix= [optional args] 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 --api-key=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx diff --git a/bots/zmirror_private.conf.template b/bots/zmirror_private.conf.template index dc31a0f..f01b749 100644 --- a/bots/zmirror_private.conf.template +++ b/bots/zmirror_private.conf.template @@ -1,5 +1,5 @@ [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) autostart=true ; start at supervisord start (default: true) autorestart=true ; whether/when to restart (default: unexpected) diff --git a/contrib_bots/lib/readme.md b/contrib_bots/lib/readme.md index 1840f77..5cf1e02 100644 --- a/contrib_bots/lib/readme.md +++ b/contrib_bots/lib/readme.md @@ -30,7 +30,7 @@ Here is an example of running the "follow-up" bot from inside a Zulip repo: 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 message explaining how to use the bot, as well as diff --git a/contrib_bots/run.py b/contrib_bots/run.py old mode 100644 new mode 100755 index a8a649b..214c2eb --- a/contrib_bots/run.py +++ b/contrib_bots/run.py @@ -1,3 +1,4 @@ +#!/usr/bin/env python from __future__ import print_function import importlib @@ -71,9 +72,9 @@ def run_message_handler_for_bot(lib_module, quiet, config_file): def run(): usage = ''' - python run.py + ./run.py - Example: python run.py lib/followup.py + Example: ./run.py lib/followup.py (This program loads bot-related code from the library code and then runs a message loop,