Book Image

Webmin Administrator's Cookbook

By : Michal Karzynski
Book Image

Webmin Administrator's Cookbook

By: Michal Karzynski

Overview of this book

Table of Contents (19 chapters)
Webmin Administrator's Cookbook
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Creating a panel with the database commands that you execute often


In the previous recipe, we created an easy-to-use control panel that allows you to execute custom commands with the click of a button. Webmin allows you to extend this functionality by adding custom commands that execute SQL queries on MySQL and PostgreSQL databases.

Getting ready

In order to follow this recipe, you will need to have a MySQL or PostgreSQL database installed and set up. Refer to Chapter 9, Running a MySQL Database Server, and Chapter 10, Running a PostgreSQL Database Server, for information on how to do this.

In this recipe, I will assume that you are running a web application that uses a database called django and stores its caches in the database table called cache. We'll create a custom command that empties (truncates) the cache table. Your situation will probably be different. So, before beginning, make a note of the following:

  • Name of the database that you want to run your query on

  • Syntax of the SQL command...