This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
echo "CPU cores: " $(grep -c 'cpu[0-9]' /proc/stat);dd if=/dev/zero bs=1MB count=1024 | sha512sum;echo "Disk bench:";dd if=/dev/zero of=/tmp/test1.img bs=1G count=1 oflag=dsync | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# src: https://gist.github.com/fbucek/f986da3cc3a9bbbd1573bdcb23fed2e1 | |
set -e # error -> trap -> exit | |
GC="\033[0;32m";BC="\033[0;34m";RC="\033[0;31m";YC="\033[0;93m";NC="\033[0m" | |
function info() { echo -e "[${BC} $@ ${NC}]"; } # blue: [ info message ] | |
function pass() { echo -e "[${GC}PASS${NC}] $@"; } # green: [PASS] | |
function warn() { echo -e "\033[0;93m$@${NC}"; } # green: [PASS] | |
function fail() { FAIL="true"; echo -e "[${RC}FAIL${NC}] $@"; } # red: [FAIL] | |
trap 'LASTRES=$?; LAST=$BASH_COMMAND; if [[ LASTRES -ne 0 ]]; then fail "Command: \"$LAST\" exited with exit code: $LASTRES"; elif [ "$FAIL" == "true" ]; then fail finished with error; else echo -e "[\033[0;32m Finished `date +"%Y-%m-%d %H:%M:%S"` took: $SECONDS s $@ \033[0m]";fi' EXIT |