Skip to content

Instantly share code, notes, and snippets.

View sennajox's full-sized avatar

Sennajox sennajox

  • Shanghai, China
View GitHub Profile
@sennajox
sennajox / run_fio.sh
Last active December 21, 2023 11:00
A script that runs fio test and genearates a simple result for each jobs
#!/bin/bash
if [ $# -lt 2 ]; then
echo "usage:$0 dev output_dir [iodepth]"
echo "example 1: Testing the whole block device. Attention: That will destory the filesystem on the target block device"
echo "./run_fio.sh /dev/sdb fio_test"
echo ""
echo "example 2: Testing a file, but not destory filesystem. Suppose the target device mount on /data"
echo "fallocate -l 1G /data/test.dat"
echo "./run_fio.sh /data/test.dat fio_test"
@sennajox
sennajox / zkMonitor.sh
Last active October 10, 2015 12:18
A script for monitor zkserver
#!/bin/bash
log="./zookeeper.out"
if [ -f "$log" ]; then
# unit(MB)
size=`du -sm "$log" | grep "$log" | awk '{print $1}'`
limit=300
# split log
if [ $size -gt $limit ]; then
newlog="zookeeper-`date +%Y%m%d%H%M%S`.log"
@sennajox
sennajox / run_all_fio.sh
Last active October 11, 2015 03:48
a script that run with differnt iodepth, it should work with my run_fio.sh
#!/bin/bash
if [ $# -lt 2 ]; then
echo "usage:$0 dev prefix"
exit 1
fi
dev="$1"
if [ "$dev" = "" ];then
@sennajox
sennajox / t_disk.sh
Created October 29, 2012 05:25
a simple script for testing disk...
#!/bin/bash
if [ $# -lt 1 ]; then
echo "usage:$0 dev"
exit
fi
dev="$1"
echo "it will rw the dev:$dev, are you sure?[Y/n]"
read cmd
@sennajox
sennajox / run_sysbench.sh
Last active June 2, 2016 03:12
A simple script for testing mysql with sysbench
#!/bin/bash
if [ $# -lt 2 ]; then
echo "usage:$0 test_name {prepare|run|cleanup|gen}"
exit 1
fi
test_name="$1"
cmd="$2"
@sennajox
sennajox / test_db.py
Created November 16, 2012 05:58
A python script for press testing mysql
#!/usr/bin/env python2
import sys, os
import random
import time
import MySQLdb
if __name__ == "__main__":
@sennajox
sennajox / gen_list.py
Created November 18, 2012 04:11
Create a simple list containing random strings
#!/usr/bin/env python
import sys, os
import string
import random
def id_generator(size=6, chars=string.ascii_uppercase):
return ''.join(random.choice(chars) for x in range(size))
if __name__ == "__main__":
@sennajox
sennajox / sector2file.sh
Last active September 17, 2019 01:52
find the file by sector in filesystem
#!/bin/bash
# sector_list sample as below:
# 0
# 512
# 4087578
# 4087579
# 6324224
#
# You should build a sector_list firstly, and then execute this script to catch the files
@sennajox
sennajox / update_nproc.sh
Last active December 14, 2015 15:28
A simple script to update the nproc of the specified process
#!/bin/bash
if [ $# -lt 1 ];then
echo "usage:$0 pid [nproc=1024000]"
exit 1
fi
pid=$1
if [ $# -ge 2 ];then
nproc="$2ll"
@sennajox
sennajox / delete_filter.sh
Created April 19, 2013 11:16
A simple script for checking whether the deleted files still in existed_list(mayby recover)
#!/bin/bash
if [ $# -lt 2 ];then
echo "usage:$0 deleted_list existed_list"
exit 1
fi
deleted_list=$1
existed_list=$2