Supervisor is a great unix program that lets you run persistant long-running programs. In general it’s easy to use and DigitalOcean ($5 a month hosting) has a great tutorial on how to set it up here.
I was interested in Supervisor because I wanted to run the mispy/twitter_ebooks repo for building some twitter bots. It gives you a great command line interface for both creating new bots (ebooks new <reponame>
) and starting the bots (ebooks start
).
For whatever reason you can’t just point Supervisor at a directory and call that command. You’ll need to find where the gem wrapper is located and run the command from there.
First find the path of the executable gem:
which ebooks
For me it was located here:
/home/shayden/.rvm/gems/ruby-2.2.2/bin/ebooks
Then we can switch the /bin/
dir to the /wrappers/
dir which is the packaged file you will tell Supervisor to run.
/home/shayden/.rvm/gems/ruby-2.2.2/wrappers/ebooks
In Supervisor the .conf file should now look like this:
[program:ebooks]
command=/home/shayden/.rvm/gems/ruby-2.2.2/wrappers/ebooks start
directory=/home/shayden/ebooks_bot/
autostart=true
autorestart=true
stderr_logfile=/var/log/ebooks.err.log
stdout_logfile=/var/log/ebooks.out.log
Now Supervisor should have no problems keeping your twitter bots alive and tweeting.