forked from aqzt/kjyw
-
Notifications
You must be signed in to change notification settings - Fork 0
/
check_os.sh
33 lines (31 loc) · 860 Bytes
/
check_os.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
#!/bin/bash
# Author: ppabc <ppabc AT qq.com>
# Blog: http://ppabc.cn
#
# Version: 0.1 1-October-2014 ppabc AT qq.com
# Notes: init script for CentOS/RadHat 5+ Debian 6+ and Ubuntu 12+
#
# This script's project home is:
# https://github.com/ppabc/linux-init-script
#
if [ -f /etc/redhat-release ];then
OS=CentOS
elif [ ! -z "`cat /etc/issue | grep bian`" ];then
OS=Debian
elif [ ! -z "`cat /etc/issue | grep Ubuntu`" ];then
OS=Ubuntu
else
echo -e "\033[31mDoes not support this OS, Please contact the author! \033[0m"
kill -9 $$
fi
OS_command()
{
if [ $OS == 'CentOS' ];then
echo -e $OS_CentOS | bash
elif [ $OS == 'Debian' -o $OS == 'Ubuntu' ];then
echo -e $OS_Debian_Ubuntu | bash
else
echo -e "\033[31mDoes not support this OS, Please contact the author! \033[0m"
kill -9 $$
fi
}