File: //proc/1284358/root/bigscoots/bsi1-dedi.sh
#!/bin/bash
BS_INSTALLDIR=/bigscoots
iptables-save > ~/firewall.rules
systemctl stop ufw.service
systemctl disable ufw.service
yum clean all
yum -y update
yum -y install epel-release
yum --setopt=strict=0 -y install network-scripts cronie git nano ntp mailx pciutils bind-utils traceroute nmap screen yum-utils net-tools dos2unix lshw python python-ctypes iotop ncurses-devel libpcap-devel gcc make wget curl which unzip e2fsprogs tar
if [ -f /etc/selinux/config ]
then
sed -i 's/SELINUX=enforcing/SELINUX=disabled/g' /etc/selinux/config && setenforce 0
sed -i 's/SELINUX=permissive/SELINUX=disabled/g' /etc/selinux/config && setenforce 0
fi
chkconfig ntpd on
ntpdate pool.ntp.org
service ntpd restart
sysctl -w net.ipv6.conf.default.disable_ipv6=0
sysctl -w net.ipv6.conf.all.disable_ipv6=0
systemctl stop firewalld.service
systemctl disable firewalld.service
systemctl set-default multi-user.target
mkdir -p /root/.bigscoots
wget -q -O /root/.bigscoots/rkey https://bigscoots.com/downloads/rkey --no-check-certificate
chmod 600 /root/.bigscoots/rkey
echo -e "\n" | ssh-keygen -t ed25519 -N ""
fupdate() {
if [[ -d "${BS_INSTALLDIR}/.git" ]]
then
cd "${BS_INSTALLDIR}"
git stash
if ! grep -q "^github.com" /root/.ssh/known_hosts >/dev/null 2>&1
then
ssh-keyscan github.com >> /root/.ssh/known_hosts
fi
git pull [email protected]:jcatello/bigscoots.git
else
rm -rf "${BS_INSTALLDIR}"
cd /
if ! grep -q "^github.com" /root/.ssh/known_hosts >/dev/null 2>&1
then
ssh-keyscan github.com >> /root/.ssh/known_hosts
fi
git clone [email protected]:jcatello/bigscoots.git
fi
}
ghubsshconf() {
cat <<EOT >> /root/.ssh/config
Host github.com
HostName github.com
IdentityFile /root/.bigscoots/rkey
EOT
}
rm -rf /bigscoots
if [ ! -f /root/.ssh/config ]
then
touch /root/.ssh/config
chmod 600 /root/.ssh/config
ghubsshconf
elif
! grep -q github.com /root/.ssh/config
then
ghubsshconf
fi
fupdate
# Check for raid
if grep Personalities /proc/mdstat | grep raid 2>/dev/null
then
rm -f /etc/cron.daily/raid
kill -9 "$(pgrep mdadm)"
sed -i '/MAILADDR/c\MAILADDR [email protected]' /etc/mdadm.conf
echo "DEVICE partitions" >> /etc/mdadm.conf
echo "/sbin/mdadm --monitor --scan --daemonize" >> /etc/rc.local
/sbin/mdadm --monitor /dev/md125 --test &
sleep 5 ; kill -9 "$(pgrep mdadm)"
/sbin/mdadm --monitor --scan --daemonize
elif lshw -C storage | grep -q "LSI\|Broadcom" 2>/dev/null
then
mkdir -p /tmp/lsi
cd /tmp/lsi || exit
wget https://docs.broadcom.com/docs-and-downloads/raid-controllers/raid-controllers-common-files/8-07-14_MegaCLI.zip
unzip ./*MegaCLI.zip
rpm -ivh ./*inux/MegaCli-*.noarch.rpm
ln -s /opt/MegaRAID/MegaCli/MegaCli64 /sbin/
ln -s /opt/MegaRAID/MegaCli/MegaCli64 /usr/local/sbin/
cd ~ || exit ; wget https://www.bigscoots.com/downloads/lsi.zip ; unzip lsi.zip
chmod +x lsi.sh
(crontab -l ; echo "0 * * * * ~/lsi.sh checkNemail") | crontab - .
rm -f /etc/cron.daily/raid
/opt/MegaRAID/MegaCli/MegaCli64 -LDSetProp -WT -Immediate -Lall -aAll
/opt/MegaRAID/MegaCli/MegaCli64 -LDSetProp -NORA -Immediate -Lall -aAll
/opt/MegaRAID/MegaCli/MegaCli64 -LDSetProp -Direct -Immediate -Lall -aAll
fi
/bigscoots/wpo_update.sh
if [ $1 = shared ]; then
bash /bigscoots/cpanel/installer_shared.sh
else
bash /bigscoots/bsi2-dedi.sh
fi