Created
February 28, 2020 02:16
-
-
Save quadcube/e403ede79014cb1ec44a8cc50657aae8 to your computer and use it in GitHub Desktop.
Quick Cytrone IP change script for existing Cytrone installation
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 | |
# CROND-JAIST CyTRONE Change IP Script | |
# chmod +x change_ip_cytrone.sh | |
# ./change_ip_cytrone.sh | |
MOODLE_VM_IP="192.168.122.232" | |
BASE_VM_I465S="192.168.122.100" | |
set -e | |
IP="$(ip route get 8.8.8.8 | awk -F"src " 'NR==1{split($2,a," ");print a[1]}')" | |
ssh-copy-id localhost | |
ssh-copy-id 127.0.0.1 | |
ssh-copy-id $IP | |
cd ~/cytrone/scripts/ | |
sed -i "s/172\.16\.1\.7/$IP/g" CONFIG | |
sed -i "s/172\.16\.1\.7/$IP/g" ~/cytrone/database/users.yml | |
ssh-copy-id root@$MOODLE_VM_IP | |
ssh root@$MOODLE_VM_IP 'sed -i "s/https:\/\/localhost/https:\/\/'"$IP"':8081/g" /var/www/html/moodle/config.php; systemctl restart httpd; exit' | |
echo "IP change completed!" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment