-
Notifications
You must be signed in to change notification settings - Fork 2.2k
/
unixbench.sh
49 lines (43 loc) · 1.52 KB
/
unixbench.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#! /bin/bash
#==============================================================#
# Description: Unixbench script #
# Author: Teddysun <[email protected]> #
# Intro: https://teddysun.com/245.html #
#==============================================================#
cur_dir=/opt/unixbench
# Check System
[[ $EUID -ne 0 ]] && echo 'Error: This script must be run as root!' && exit 1
[[ -f /etc/redhat-release ]] && os='centos'
[[ ! -z "`egrep -i debian /etc/issue`" ]] && os='debian'
[[ ! -z "`egrep -i ubuntu /etc/issue`" ]] && os='ubuntu'
[[ "$os" == '' ]] && echo 'Error: Your system is not supported to run it!' && exit 1
# Install necessary libaries
if [ "$os" == 'centos' ]; then
yum -y install make automake gcc autoconf gcc-c++ time perl-Time-HiRes
else
apt-get -y update
apt-get -y install make automake gcc autoconf time perl
fi
# Create new soft download dir
mkdir -p ${cur_dir}
cd ${cur_dir}
# Download UnixBench5.1.3
if [ -s UnixBench5.1.3.tgz ]; then
echo "UnixBench5.1.3.tgz [found]"
else
echo "UnixBench5.1.3.tgz not found!!!download now..."
if ! wget -c https://dl.lamp.sh/files/UnixBench5.1.3.tgz; then
echo "Failed to download UnixBench5.1.3.tgz, please download it to ${cur_dir} directory manually and try again."
exit 1
fi
fi
tar -zxvf UnixBench5.1.3.tgz && rm -f UnixBench5.1.3.tgz
cd UnixBench/
#Run unixbench
make
./Run
echo
echo
echo "======= Script description and score comparison completed! ======= "
echo
echo