Archive for 2014

Bash script to execute a MariaDB query multiple times

This simple bash script will execute a query 100 times against a MySQL instance. It also uses the time command to report how long the entire process took. I use this for some very simple bench-marking. The query used here creates a temporary table and inserts 100K rows into it. You need the sequence engine […]

TSQL: Restore a multiple file backup

Just a follow up post using the backup files created in TSQL: Backup a database to multiple files. Here’s the script I used… ?View Code TSQLSET STATISTICS IO ON; SET STATISTICS TIME ON; GO   — Single file restore RESTORE DATABASE dbname FROM DISK = ‘\\path\to\backup\location\tmp\single_file_backup.bak’ WITH RECOVERY, MOVE ‘dbname’ TO ‘d:\SQLData\dbname.mdf’, MOVE ‘dbname_log’ TO […]

Copy date stamped backups with a regex & scp

Lets assume you have a directory of date stamped backups you want to scp to another location… backup_20141003.tar.gz backup_20141004.tar.gz backup_20141005.tar.gz backup_20141006.tar.gz backup_20141007.tar.gz backup_20141008.tar.gz backup_20141009.tar.gz scp can accept a regex like below to do this as a one-liner. Note the quotes are required for the expression to work. ?View Code BASHscp "user@hostname:/data/backup/backup_2014100[3-9].tar.gz" /path/to/location/ You should see […]

TSQL: Backup a database to multiple files

I wanted to see how much I could reduce backup times by specifying multiple files in the BACKUP TSQL command. Here’s a script I wrote to do this and I present a summary of the results below. The times are based on a database that produced a backup file(s) of approximately 51GB. You mileages will […]

Check a html page with check_http

With the check_http Nagios plugin we can check that a url returns an OK status code as well as verifying the page contains a certain string of text. The usage format is a s follows… ?View Code BASH/usr/local/nagios/libexec/check_http -H hostname -r search_string For example… ?View Code BASH/usr/local/nagios/libexec/check_http -H www.youdidwhatwithtsql.com -r "wordpress" If you want to make […]