mirror of
https://github.com/serghey-rodin/vesta.git
synced 2025-08-21 05:44:07 -07:00
Workaround for stopped Amazon instance
This commit is contained in:
parent
e7c94357a4
commit
4a34f94ebd
1 changed files with 47 additions and 2 deletions
|
@ -33,9 +33,55 @@ is_object_valid 'user' 'USER' "$user" "$user"
|
|||
# Action #
|
||||
#----------------------------------------------------------#
|
||||
|
||||
# Get list of ip addresses
|
||||
ip_list=$(/sbin/ifconfig | grep 'inet addr:' | cut -f 2 -d : | \
|
||||
cut -f 1 -d ' '| grep -v 127.0.0.1)
|
||||
ip_num=$(echo "$ip_list" | wc -l)
|
||||
|
||||
# WorkAround for Amazon stop/start issue
|
||||
vst_ip_list=$(ls $VESTA/data/ips/)
|
||||
vst_ip_num=$(echo "$vst_ip_list" | wc -l)
|
||||
|
||||
if [ "$ip_num" -eq '1' ] && [ "$vst_ip_num" -eq '1' ]; then
|
||||
if [ "$ip_list" != "$vst_ip_list" ]; then
|
||||
new=$ip_list
|
||||
old=$vst_ip_list
|
||||
mv $VESTA/data/ips/$old $VESTA/data/ips/$new
|
||||
if [ ! -z "$PROXY_SYSTEM" ]; then
|
||||
mv /etc/$PROXY_SYSTEM/conf.d/$old.conf \
|
||||
/etc/$PROXY_SYSTEM/conf.d/$new.conf
|
||||
sed -i "s/$old/$new/g" /etc/$PROXY_SYSTEM/conf.d/$new.conf
|
||||
$BIN/v-restart-proxy
|
||||
fi
|
||||
if [ ! -z "$WEB_SYSTEM" ]; then
|
||||
mv /etc/$WEB_SYSTEM/conf.d/$old.conf \
|
||||
/etc/$WEB_SYSTEM/conf.d/$new.conf
|
||||
sed -i "s/$old/$new/g" /etc/$WEB_SYSTEM/conf.d/$new.conf
|
||||
sed -i "s/$old/$new/g" $VESTA/data/users/*/web.conf
|
||||
|
||||
# Rebuild web domains
|
||||
for user in $(ls $VESTA/data/users/); do
|
||||
$BIN/v-rebuild-web-domains $user no
|
||||
done
|
||||
$BIN/v-restart-web
|
||||
fi
|
||||
|
||||
if [ ! -z "$DNS_SYSTEM" ]; then
|
||||
# Rebuild dns domains
|
||||
for user in $(ls $VESTA/data/users/); do
|
||||
sed -i "s/$old/$new/g" $VESTA/data/users/$user/dns.conf
|
||||
sed -i "s/$old/$new/g" $VESTA/data/users/$user/dns/*.conf
|
||||
$BIN/v-rebuild-dns-domains $user no
|
||||
done
|
||||
$BIN/v-restart-dns
|
||||
fi
|
||||
|
||||
# No further comparation is needed
|
||||
exit
|
||||
fi
|
||||
fi
|
||||
|
||||
# Compare ips
|
||||
for ip in $ip_list; do
|
||||
if [ ! -e "$VESTA/data/ips/$ip" ]; then
|
||||
iface=$(/sbin/ifconfig |grep -B1 -w $ip |head -n1 |cut -f1 -d ' ')
|
||||
|
@ -43,11 +89,10 @@ for ip in $ip_list; do
|
|||
mask=$(/sbin/ifconfig |grep -w $ip |awk -F "Mask:" '{print $2}')
|
||||
$BIN/v-add-sys-ip $ip $mask $interface
|
||||
fi
|
||||
|
||||
# TBD: revers comparation
|
||||
done
|
||||
|
||||
|
||||
|
||||
#----------------------------------------------------------#
|
||||
# Vesta #
|
||||
#----------------------------------------------------------#
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue