English, Technik

Etherpad Lite and Bash

I already wrote about Etherpad Lite. Now as I got my install up and running, I thought about getting control over it. First point was, I wanted to control the creation of pads. I have not yet understood the groups and group pads, so this will be all very very basic, but maybe still be of some help. Take into account that I use Etherpad Lite version 1.2.91, so things might be different if you have another version.

First of all I wanted to be the one to create the pads. Exclusively, because if people want to start free pads, they can just use any of the open instances out there.

So I switched off pad creation in the settings.json by setting editOnly to true:

Thus there is no pad creation through the browser interface. We have to create pads throught the API. I decided to use bash scripts, because it’s easy to do and works. The script to create new pads looks like this:

You have to set the server and the api key to the proper values. The server should be localhost in most cases, and port 9001 is the standard port used by Etherpad Lite. The api key can be found in the apikey.txt file within the Etherpad Lite directory.

The script goes through all arguments you pass to the script and creates pads with respective names, by making use of the HTTP API through the curl command.

Next needed is a script to show all existing pads. I used the mysql command found on the Wiki. For some reason the first didn’t work, so I wa lucky there was a second SQL command on the Wiki just below the first. So I didn’t do anything here, just some copy and paste:

You just need to set your username and password for the mysql database of your Etherpad Lite install, and that’s it.

The last thing needed was a way to get rid of old pads, because there isn’t yet a delete key in the browser interface:

Almost identical to the Pad creation script. Again you have to set your server and API key, and again you can delete several pads on the same time.

This gives me just what I wanted to be able to do by now: Create pads that can be edited by anyone, but let no one create their own pads.

In case any of you really has use for this, don’t forget to chmod +x your new scripts 😉

One thought on “Etherpad Lite and Bash

Schreibe einen Kommentar

Deine E-Mail-Adresse wird nicht veröffentlicht. Erforderliche Felder sind mit * markiert.