generate_blogpost.sh

wordpress

I use a homegrown shell script to publish my posts on this site. When I migrated to WordPress, I imported lots of existing posts and pages that I also wanted to be able to update with blogpost.py. So, I wrote a script to generate the .blogpost files for those posts and pages: generate_blogpost.sh.

The script isn’t too complicated. It just fetches all existing pages and posts from MySQL, finds the corresponding .txt files in the working directory, and generates corresponding .blogpost files using the post ids, types, titles, and permalinks stored in the database.

To run it, simply pass the same parameters you’d pass to mysql, e.g.

$ ./generate_blogpost.sh -h [HOST] -u [USER] [DATABASE]

Leave a Reply

Your email address will not be published. Required fields are marked *