Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 81 lines (60 sloc) 2.461 kb
fce9f08 @atoponce Add README with instructions. Make script changes.
authored
1 # IRC-to-SMS
2
3 This script provides a 0mq client to subscribe to IRC events, and send them
4 to a moble number using an email-to-sms gateway provided by a mobile
bef8f59 @atoponce fix links
authored
5 provider. See https://en.wikipedia.org/wiki/List_of_SMS_gateways for a list
fce9f08 @atoponce Add README with instructions. Make script changes.
authored
6 of providers.
7
8 ## Requirements
9
10 This script relies on a 0mq Ruby script for WeeChat which can be found
bef8f59 @atoponce fix links
authored
11 here: http://weechat.org/scripts/source/stable/zmq_notify.rb.html/. The
fce9f08 @atoponce Add README with instructions. Make script changes.
authored
12 Ruby script creates a YAML load (not valid, but meh) and sets up a PUB 0mq
13 socket to send the message to. So, some requirements must be met for that
14 to work:
15
16 - weechat-curses (compiled with Ruby support)
17 - ruby1.9.1
18 - ruby1.9.1-dev
19 - 0mq (can be installed with "gem install zmq")
20
21 Restart WeeChat, load the script, and bind the socket to localhost on port
22 2428:
23
60f46d4 @atoponce fix links
authored
24 /ruby load zmq_notify.rb
fce9f08 @atoponce Add README with instructions. Make script changes.
authored
25 /set plugins.var.ruby.zmq_notify.endpoint tcp://127.0.0.1:2428
26
27 You should notice a TCP socket created, and listening for connections. This
28 is your 0mq socket. Now, you need to setup the requirements necessary for
29 this Python script:
30
31 - python2.7
32 - python-zmq
33 - python-yaml
34 - A running SMTP server that can send outbound email
35
936bf6a @atoponce add installation section header
authored
36 ## Installation
37
fce9f08 @atoponce Add README with instructions. Make script changes.
authored
38 I setup the script to execute in /etc/rc.local using the following code:
39
40 $ cat /etc/rc.local
41 /usr/local/bin/email-0mq.py 2> /var/log/0mq.err > /dev/null &
42
43 Then I can '/etc/init.d/rc.local stop' and '/etc/init.d/rc.local start' as
44 needed. A proper init script should probably be written, and I'll
45 eventually provide one here.
46
47 At this point, you should be able to enable the script to bind the socket
48 from your WeeChat client
49
50 /set plugins.var.ruby.zmq_notify.enabled on
51
52 Now start the Python script from the shell:
53
54 # /etc/init.d/rc.local start
55
56 And verify that it has established the connection:
57
58 $ netstat -taupen | grep 2428
59 tcp 0 0 127.0.0.1:2428 0.0.0.0:* LISTEN 1000 7333346 3205/weechat-curses
60 tcp 0 0 127.0.0.1:33115 127.0.0.1:2428 ESTABLISHED 0 7335329 26786/python
61 tcp 0 0 127.0.0.1:2428 127.0.0.1:33115 ESTABLISHED 1000 7335330 3205/weechat-curses
62
63 Because there is logging to /var/log/, you may want to configure logrotate
64 to rotate the log files. Here is what I added to my configs:
65
66 $ cat /etc/logrotate.d/0mq
67 /var/log/0mq.err {
68 rotate 6
69 daily
70 compress
71 missingok
72 notifempty
73 }
74 /var/log/0mq.out {
75 rotate 6
76 daily
77 compress
78 missingok
79 notifempty
80 }
Something went wrong with that request. Please try again.