perl

Simple Shell Script to Monitoring Disk Space on a Linux Machine

This article explain a way to get a mail as soon as the disk usage reaches to its critical level to avoid issues later. To set a simple monitor on Linux / Unix, I have two simple scripts: DSAlert.sh : Shell script for retrieving disk space percentages and put in to a cron job. DiskSpace_Alert.pl : Perl script for sending an email. Following is the disk monitor shell script which will execute the perl file for sending alert email. #DSAlert.sh #!/bin/sh #Retrive disk space info df=`df -Pl  | grep “^/dev” | awk ‘{print $5, $6}’ | sed “s/%//”` #Reference: df echo “$df” | while read percent fs do #If Disk...

Perl Script for Analyze – Optimize – Repair Mysql Databases

The perl script is mainly created to avoid manual Mysql Server Maintenance. The script uses Perl module DBI. You need to provide access credentials and database name(optional). Regarding Analyse, Optimize and Repair you may ofcourse refer dev.mysql.com. OPTIMIZE TABLE should be used if you have deleted a large part of a table or if you have made many changes to a table with variable-length rows (tables that have VARCHAR, VARBINARY, BLOB, or TEXT columns). Deleted rows are maintained in a linked list and subsequent INSERT operations reuse old row positions. You can use OPTIMIZE TABLE to reclaim the unused space...