Plog is a suite of some scripts to be run on a UNIX server for handling Markdown formatted blogs, glogs, and email newsletters with Git.

An example of the generated output can be found at my personal blog and glog sites.

This is describing version 3.2 of the suite.

Notes about the Gopher protocol

Please note that most browsers are unfortunately incapable of displaying Gopher links!

There is a fine Public Gopher Proxy on Floodgap for those crippled browsers. Therefore, if the direct gopher link above does not work, you may try to access it via proxy.

If you are using Seamonkey or older versions of Firefox, you may try the "OverbiteFF" add-on for Gopher functionality. Overbite also is available for Android, via or Floodgap.

Installation and Usage


The plog suite mainly consists of the (sh/bash) shell scripts and, a configuration file, and a suitable directory structure. If you make use of character conversion (UTF8 or the like), also the script will be needed.

It makes use of the standard command line tools like grep and sed available on almost all Unix systems.

In addition, it needs perl (version 5.6) for Markdown-HTML conversion (and of course the corresponding script included in the plog suite), and lynx for HTML-text conversion.

git is used to git mv the processed files to an archive directory; however, in case of failure, the scripts should gracefully switch to a simple mv.

The main scripts,,, should be installed in the same directory.

There is an additional bonus script which uses and to convert all *.md files in the current directory into *.html files. It can be given the name of a CSS style file which then will be referred to as style file. This can be used as a simple static website generator.

Customisation of scripts with .plog.rc

The two shell scripts have some variables set at the beginning, which should be configured to your needs.

They can be used for processing several collections of postings through the run-time argument of the working directory (see below). In case you need very different configuration, you can simply copy the scripts and use different instances for different collections.

The scripts share a common configuration file .plog.rc, which has to be in the working directory. It is basically an additional shell script which is executed at the beginning of each of the other scripts, but after setting of the variables. This way, values set in the configuration file will override the defaults hardcoded in scripts.

In the plog suite, there is a plogrc.template file, which can be copied into .plog.rc, and modified according to your needs.

Here is a copy of the current template file, followed by a detailed description of all used variables.

## Template file for plog configuration
## Please copy as .plog.rc and modify as needed!
## Note: uses "$wdir" and "$mydir" as defined by calling script!

# set to additional existing file,
# if you want to include additional local config
# which will be processed at the end

# list of e-mail addresses

# directory to save text files for publication
# number of text files to be included in the index
# name of index file for text
# header for text index file
indtexthead='most recent entries in reverse chronological order'

# directory to save HTML files for publication
# number of HTML files to be included in the index
# name of index file for HTML/blog
# title in index file for HTML/blog
indhtmltitle='blog title'
# name of RSS file (to be saved in $pubhtml):
# title in RSS file
rsstitle='blog feed'
# description in RSS file
rssdesc='blog description'

# base name of HTML/blog directory (from outside):

# prefix for mail subject

# prefix for text file names

# mark for publication-ready texts (must be at beginning of one line)
# all up to and including this line will be removed before publication!

# archive directory for processed texts

htmlfoot="</BODY><!-- generated by $myself --></HTML>"


# special chars to HTML converter
# set to 'cat' if unused
# markdown to HTML converter
# HTML tag marker for textual output
# HTML to text converter
convert3='lynx -display_charset=US-ASCII -force-html -dump -stdin'
# e-mail transmission program
# mailer="logit ::" # test dummy

# temporary file for saving HTML file
# temporary file for saving text file

# lockfile

if test -r "$localrc"
then . "$localrc"

Please note:

Usage considerations


In any case, you need a directory (the "working directory"), where the source texts (Markdown formatted) are stored. Typically, this would be inside of a directory which is version controlled by Git, but plog should still work without that. In this directory, as well as its subdirectories, and additional directories needed for publication, the plog scripts (either launched manually by you or by some automatic process like a cron job) in principal need complete access permission (read, write, and execute).

As a subdirectory, you should set up the archive directory, and you have to accordingly set the variable arch in

In the working directory, you have to set up the configuration script .plog.rc; you can use plogrc.template as a starting point.

File names for "posts", or source texts

Next, you have to choose how to name your source files: they all need a common prefix, so that plog knows what to look for. Please make sure not to use a prefix that would match any of the additional files or directories residing in the working directory, or the scripts may crash or even destroy necessary files or get into an infinite loop! Good choices might be simply t, or text, or post, or any letter combination not including the address file; don't use any punctuation, except for - or _ after at least one letter.

Set this prefix as a pattern in the configuration variable tprefix. (The file suffix is irrelevant: They will all be treated as text files.) will generate the list of all files matching the prefix pattern, and then process the first file in that list which does bear the "publication-ready pattern" as defined by the pubready variable. All lines up to and including this pattern will be ignored, i.e remain unpublished; you can use this to keep private notes before this pattern. If you want to have your files processed in a certain order, you should therefore name them in such a way that the lexical order of their names corresponds to the desired processing order. An example would be naming them as pYYMMDDI, where YYMMDD is indicating year, month, and day of writing, with a possible additional index letter I, or with a numerical index NNN.

E-mail addresses

If you want to send an e-mail newsletter, you have to list the recipient addresses in a file whose name needs to be set in the adds variables of the scripts.

This file should be a simple text file with one recipient address per line. Lines beginning with # are ignored and can be used for comments. However, never use # after an address: it would be part of the latter!

If you do not need the newsletter functionality, you still should have an address file! It can be empty (or only contain comment lines), but it should be present and readable. If the file is missing, some scripts may issue error messages.

Remember: you need a working command line mailer for this. Please set the mailer configuration variable accordingly, but not all systems providing shell access may allow you to use it.

Script execution

Both and can of course be executed manually. However, in most cases, it might be more useful to launch them automatically, e.g from a daily or weekly cron job. processes just the next available (non-draft) post, and send it in processed (HTML and pure text) form to all e-mail recipients, and save the processed forms in the appropriate directories for later use (blog/glog publication). will call repeatedly, until the latter cannot find any available post, and then generate index files in HTML and pure text version for publication as blog and glog.

Git hook for script execution

It is possible to run automatically and remotely, if its directory is under git version control. For this, you must run once on the publishing server; it installs a git "post-update" hook which is run whenever you push the git repo's content from a remote system. The hook in turn changes to the repo's working directory and runs in there. (This of course won't work in the situation described below, where publication and script execution should run as different users.)

Example: If you had the working directory on the server at /some/where/ and the (bare) git repo (which you use to push to from a remote location) at /home/yourself/bare.git then you could issue the command ./ /home/yourself/bare.git /some/where/.git/ on the server to have this set up. Please note: the script expects a directory ./hooks/ to be in /some/where/.git/ and will also verify this.

If you want to mirror a repo somewhere else, you might have the config file .plog.rc tracked by git, but at the same time require different settings on the mirror host. To solve this, you may use a localrc variable as demonstrated in the sample config file plogrc.template : this variable can point to a local config which is processed after the standard .plog.rc file, and therefore can override the latter.

Publication (blog/glog)

(This section may be ignored, if publication happens via git hooks.)

As it might not be desirable to publish the generated HTML and pure text files (together with their respective index files) as the same user who launched the plog scripts, a copying step for the final publication may be necessary.

A possible solution is given in the script It simply uses rsync to pull the files from a "remote" directory (which of course may be on the same machine) to a "local" directory, and make all of them world readable. Also a simple cp could of course be used, but rsync only copies files which are not yet present in the target ("local") directory.

If you want to make use of, please set its variables according to your working and publication directories! You should understand how rsync is working before doing so, though.

Example with Git hook setup for testing

To test the system locally, you can do as follows; we assume $src is the directory containing the source code (plog installation).

  1. choose a directory $loc for testing; /tmp is fine for this
  2. cd $loc
  3. create a bare directory (the "repo"): git init --bare repo.git
  4. create the working directory: git init workdir
  5. create target directories: mkdir text html
  6. copy the config template: cp $loc/plogrc.template workdir/.plog.rc
  7. edit the template: cd workdir ; $EDITOR .plog.rc at least setting pubtext=/tmp/text and pubhtml=/tmp/html (replace /tmp by whatever you've chosen for $loc)
  8. add the config to the repo (safer, but not required): git add .plog.rc
  9. do an initial commit: git commit -m initial
  10. set the "remote" repo: git remote add origin ../repo.git (or whatever)
  11. push to the repo: git push -u origin master
  12. initialize the hook: $src/ $loc/repo.git $loc/workdir
  13. add some text: $EDITOR test.txt; git add test.txt; git commit -m 'first post' while making sure the name of the text file begins with the prefix set in the config file, which by default is t
  14. if you want to "publish" the text, make sure to add a line :publish (or whatever has been chosen for the pubready config variable) at the beginning of the text — remember everything before that line will be ignored for publication
  15. to see what has been published, do git pull in the working directory after pushing/publishing, as this will show the published files in the archive; the remote will also report while pushing
  16. repeat from step 12 for more text

Please note that the steps 1 to 10 are a common workflow for setting up a local git repo with a working directory on the same machine. When working with a (true) remote server, only the workdir would be on a local machine, but all the other files and directories would have to be installed on the server, and the remote in step 9 (on the local machine) set accordingly; for this to work, obviously you need shell access on the server.

Remember to set .plog.rc.local on different remote servers, if you do mirroring of the same content, as the config most probably will have to be different, and this way you can still keep the .plog.rc for the main publication server in the repo.

2019-Dec-21 / HB9KNS

# Copyright 2015,2019 Yargo Bonetti / HB9KNS
# This file is part of plog.
# plog is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# plog is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with plog.  If not, see <>.