Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- clean_up() {
- echo "clean up..."
- PID=$(pidof redis-server)
- if [ $? != 1 ]; then
- kill -9 $PID
- fi
- }
- trap clean_up SIGINT
- run_it() {
- echo "runing..."
- if [ -f ../redis.conf ]; then
- redis-server ../redis.conf &
- return 0
- else
- echo "without config file"
- return 1
- fi
- }
- do_benchmark() {
- echo "do benchmark"
- pidof redis-server
- if [ $? != 1 ]; then
- redis-benchmark > benchmark$(date +%s).list
- fi
- }
- ready() {
- sysctl -w vm.drop_caches=3
- swapoff -a
- if [ -d benchmark$(date +%d) ]; then
- pushd benchmark$(date +%d)
- else
- mkdir benchmark$(date +%d)
- pushd benchmark$(date +%d)
- fi
- echo "let go.."
- }
- main() {
- ready
- run_it
- if [ $? == 0 ]; then
- do_benchmark
- clean_up
- else
- clean_up
- fi
- }
- main
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement