Skip to content

Instantly share code, notes, and snippets.

View tcooper's full-sized avatar

Trevor Cooper tcooper

View GitHub Profile
@tcooper
tcooper / send-to-graphite.py
Last active August 29, 2015 14:04
Used to send diamond archives to graphite to fill in gaps when server was down.
#!/usr/bin/env python
# Replace locahost with the hostname of your graphite server
import os
import socket
import sys
CARBON_SERVER = 'localhost'
CARBON_PORT = 2003
@tcooper
tcooper / make-home-dir
Created July 17, 2014 23:33
Create a home directory for the specified user with values from /etc/passwd and contents of /etc/skel
#!/bin/sh
/usr/bin/getent passwd $1 2>&1 > /dev/null
if [ $? -ne 0 ];
then
echo "Invalid user"
exit 1
fi
@tcooper
tcooper / create_pool.sh
Created June 16, 2014 23:22
Create a RAID-Z2 pool on Campfire NAS
#!/bin/bash
# Create the zfs pool as 4 RAID-Z2 vdev's...
zpool create pool raidz2 \
wwn-0x5000cca00d6f3910 \
wwn-0x5000cca00d72a644 \
wwn-0x5000cca00d7b8158 \
wwn-0x5000cca00d7d376c \
wwn-0x5000cca00d7f49c4 \
wwn-0x5000cca00d7ff4e8
@tcooper
tcooper / etc-initd-mysqld-patch
Created May 7, 2014 23:55
Patch to 'fix' CentOS 6.5 mysql-server init script to allow use of non-standard user specified in /etc/my.cnf
--- /etc/init.d/mysqld.orig 2014-02-12 11:42:13.000000000 -0800
+++ /etc/init.d/mysqld 2014-05-07 16:48:24.426343648 -0700
@@ -50,6 +50,8 @@
get_mysql_option mysqld datadir "/var/lib/mysql"
datadir="$result"
+get_mysql_option mysqld user "mysql"
+user="$result"
get_mysql_option mysqld socket "$datadir/mysql.sock"
socketfile="$result"
@tcooper
tcooper / building_lustre_client_rpms.md
Created April 18, 2014 21:53
Lustre Client RPM Build Process

Lustre 2.4.2 Client Build

Basic sequence to download/build Lustre client rpms...

  1. clone
  2. checkout
  3. autogen
  4. configure
  5. make
  6. make rpms
@tcooper
tcooper / patching_lustre_client_rpms.md
Last active April 9, 2017 20:41
Lustre Client RPM Patch/Build Process

Patching Lustre Client RPM's

This example will apply a patch for LU-4558 to Lustre v2_4_3 and rebuild the client RPM's.

The Gerrit site for Lustre is at...

http://review.whamcloud.com/
@tcooper
tcooper / sdc_raw_libaio_direct.fio
Created March 7, 2014 18:27
FIO test script for raw device, ioengine=libaio, oflag=direct
[global]
ioengine=libaio
invalidate=1
ramp_time=30
iodepth=1
runtime=180
time_based
direct=1
[write-sdc-4k-seq]
@tcooper
tcooper / dd_test.sh
Created March 7, 2014 18:15
Script for testing block device(s) using dd
#!/bin/bash
# Script for testing block device(s) using dd
#
# Actual files sizes written may be slightly smaller than the target due to bc's
# default truncation of floating point results.
#
# Read tests use /dev/null as the output device.
#
@tcooper
tcooper / gen_hash.sh
Created December 18, 2013 20:28
Generates a 'binary_hashes' entry for supplied object(s)
#!/bin/bash
# Generates a 'binary_hashes' entry for supplied object(s)
for OBJ in "$@"
do
OBJ_BASENAME=`basename ${OBJ}`
OBJ_DIRNAME=`dirname ${OBJ}`
if [ -f ${OBJ} ]; then
@tcooper
tcooper / fix_export.sh
Last active December 31, 2015 16:19
Fixes /export -> /state/partition1 on a Rocks devel appliance
#!/bin/bash
#
# Fixes the /export -> /state/partition1 symlink on a Rocks devel appliance in Rocks 6.1
#
# Author: Trevor Cooper <tcooper@sdsc.edu>
# Twitter: @HPCDevOps
# GitHub: https://github.com/tcooper
#