Created
February 27, 2016 16:13
-
-
Save sumitdhameja/e44907b32381cdbfb812 to your computer and use it in GitHub Desktop.
Clone - Ubuntu
This file contains 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
#!/bin/bash | |
if [ "$#" -ne 2 ]; then | |
echo "Parameters:" | |
echo "1- Host (irvwebxlx01)" | |
echo "2- IP (10.50.7.201)" | |
exit 1 | |
fi | |
_host=$1 | |
_ip=$2 | |
echo "[-] Setup $_host ($_ip)" | |
read -p "Are you sure? " -n 1 -r | |
echo "" | |
if [[ ! $REPLY =~ ^[Yy]$ ]] | |
then | |
exit 1 | |
fi | |
# Change IP | |
sed -i "s/address .*$/address $_ip/g" /etc/network/interfaces | |
# Change Hostname | |
sed -i "s/dc_other_hostnames=.*/dc_other_hostnames='""$_host""'/g" /etc/exim4/update-exim4.conf.conf | |
echo "$_host" > /etc/hostname | |
# Add to hostfile | |
echo "$_ip $_host" >> /etc/hosts | |
# Restart Service | |
# service network restart | |
read -p "Reboot? " -n 1 -r | |
echo "" | |
if [[ $REPLY =~ ^[Yy]$ ]] | |
then | |
reboot | |
fi | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment