Commit 6d084095 authored by Matteo Quintiliani's avatar Matteo Quintiliani
Browse files

Fix redirect to OUTPUTFILE

parent 7f157e43
......@@ -66,7 +66,7 @@ configure_public_keys()
configure_apt()
{
echo_date "apt-get update and install" >> $OUTPUTFILE
echo_date "apt-get update and install"
# install needed bits in a loop because a lot of installs happen
# on VM init, so won't be able to grab the dpkg lock immediately
......@@ -84,9 +84,9 @@ configure_git()
local repo=${3}
local key=${4}
echo_date "Configuring git key $key" >> $OUTPUTFILE
echo_date "Configuring git connectivity for $repo" >> $OUTPUTFILE
echo_date "Registering git domain: $host" >> $OUTPUTFILE
echo_date "Configuring git key $key"
echo_date "Configuring git connectivity for $repo"
echo_date "Registering git domain: $host"
if [ ! -z "$key" ]; then
setup_sshkey $key $host $user
......@@ -94,11 +94,11 @@ configure_git()
# remove html dir so we can clone into it
rm -rf ${GITBASEDIRCURREPO}
echo_date "Attemtping git clone of dncc repo.." >> $OUTPUTFILE
echo_date "git clone git@$host:$user/$repo.git ${GITBASEDIRCURREPO}" >> $OUTPUTFILE
echo_date "Attemtping git clone of dncc repo.."
echo_date "git clone git@$host:$user/$repo.git ${GITBASEDIRCURREPO}"
git clone git@$host:$user/$repo.git ${GITBASEDIRCURREPO}
else
echo_date "no SSH private key. Skipping setup" >> $OUTPUTFILE
echo_date "no SSH private key. Skipping setup"
fi
}
......@@ -114,20 +114,20 @@ configure_nginx()
ln -s ${GITBASEDIRCURREPO}/cnt.rm.ingv.it/root/etc/nginx/nginx.conf
cd /etc/nginx/conf.d
ln -s ${GITBASEDIRCURREPO}/cnt.rm.ingv.it/root/etc/nginx/conf.d/cnt.conf
service nginx configtest 2>&1 >> $OUTPUTFILE
service nginx restart 2>&1 >> $OUTPUTFILE
service nginx configtest
service nginx restart
}
configure_iptables()
{
echo_date "Check \"iptables\" installation:" >> ${OUTPUTFILE} 2>&1
dpkg-query -W -f='${Status} ${Version}\n' iptables >> ${OUTPUTFILE} 2>&1
echo_date "Check \"iptables\" installation:"
dpkg-query -W -f='${Status} ${Version}\n' iptables
RETURNED_VAL=${?}
echo "RETURNED_VAL:${RETURNED_VAL}" >> ${OUTPUTFILE} 2>&1
echo_date "Done" >> ${OUTPUTFILE} 2>&1
echo "RETURNED_VAL:${RETURNED_VAL}"
echo_date "Done"
if (( ${RETURNED_VAL} == 0 )) && [ -d ${GITBASEDIR}/cnt.rm.ingv.it/root/etc/firewall/ ]; then
echo_date "Configuring \"iptables\":" >> ${OUTPUTFILE} 2>&1
echo_date "Configuring \"iptables\":"
mkdir /etc/firewall
cd /etc/firewall
ln -s ${GITBASEDIR}/cnt.rm.ingv.it/root/etc/firewall/firewall.openall.sh
......@@ -136,21 +136,21 @@ configure_iptables()
cd /etc/init.d
ln -s ${GITBASEDIR}/cnt.rm.ingv.it/root/etc/init.d/iptables
/etc/init.d/iptables start >> ${OUTPUTFILE} 2>&1
echo_date "Done" >> ${OUTPUTFILE} 2>&1
/etc/init.d/iptables start
echo_date "Done"
fi
}
configure_fail2ban()
{
echo_date "Check \"fail2ban\" installation:" >> ${OUTPUTFILE} 2>&1
dpkg-query -W -f='${Status} ${Version}\n' fail2ban >> ${OUTPUTFILE} 2>&1
echo_date "Check \"fail2ban\" installation:"
dpkg-query -W -f='${Status} ${Version}\n' fail2ban
RETURNED_VAL=${?}
echo "RETURNED_VAL:${RETURNED_VAL}" >> ${OUTPUTFILE} 2>&1
echo_date "" >> ${OUTPUTFILE} 2>&1
echo "RETURNED_VAL:${RETURNED_VAL}"
echo_date ""
if (( ${RETURNED_VAL} == 0 )) && [ -d ${GITBASEDIR}/cnt.rm.ingv.it/root/etc/fail2ban/ ]; then
service fail2ban stop >> ${OUTPUTFILE} 2>&1
service fail2ban stop
DIR_FAIL2BAN="/etc/fail2ban"
if [ -d ${DIR_FAIL2BAN} ]; then
......@@ -187,25 +187,22 @@ configure_fail2ban()
done
fi
service fail2ban start >> ${OUTPUTFILE} 2>&1
service fail2ban start
fi
}
SEPLINE="============================================="
echo "$SEPLINE" >> $OUTPUTFILE
echo "$SEPLINE" 2>&1 >> ${OUTPUTFILE}
date 2>&1 >> ${OUTPUTFILE}
echo "$@" 2>&1 >> ${OUTPUTFILE}
echo "$SEPLINE" 2>&1 >> ${OUTPUTFILE}
echo "From gitlab.rm.ingv.it" >> $OUTPUTFILE
date >> $OUTPUTFILE
echo "Hello World" >> $OUTPUTFILE
echo "$@" >> $OUTPUTFILE
echo "$SEPLINE" >> $OUTPUTFILE
configure_public_keys
configure_apt
configure_git $gitHostName $gitGroupName $gitRepoName $gitSshPrivateKey
configure_nginx
configure_iptables
configure_fail2ban
configure_public_keys 2>&1 >> ${OUTPUTFILE}
configure_apt 2>&1 >> ${OUTPUTFILE}
configure_git $gitHostName $gitGroupName $gitRepoName $gitSshPrivateKey 2>&1 >> ${OUTPUTFILE}
configure_nginx 2>&1 >> ${OUTPUTFILE}
configure_iptables 2>&1 >> ${OUTPUTFILE}
configure_fail2ban 2>&1 >> ${OUTPUTFILE}
cat $OUTPUTFILE
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment