Linux : custom shell framework and scripts for my servers

As a lazy sysadmin, I try to make my servers as autonomous as possible : auto-backup, auto-sync tmpfs, report disk status by email, etc.

For all of that, I use a custom little shell framework and some scripts that I share with all my servers through my own git repository.

I decided to publish theses files : it might be useful for some one ;).  The “framework” and configuration variables are in bluemind_shellFramework.zip whereas scripts are in bluemind_shellScripts.zip.

What the framework provides

Description

Basicaly, the framework has the following features :

  • Redirect all output to a formated log file (eg: prefix added to every line)
  • Log file send to admin
  • Error manager (auto umounts, send mail, etc.)
  • Provides base functionalities such as directory sync, log writing, mysql backup, directory backup, changes detection in directory, etc.

Output example

The framework allows me to write small scripts that output log file like the following (for instance, a backup script):

 

Example scripts

To give some ideas of the framework usage, bellow is 2 examples of scripts I use (together with cron).

Sync logs and backup files from tmps mountpoint to a static storage, plain, simple:

 

Another one to backup whole file system and mysql databases with automatic detection of dedicated mount points for /boot and/or /var :

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.