Permalink
Browse files

update vesta templates

  • Loading branch information...
serghey-rodin committed Jun 11, 2013
1 parent 780641b commit 349308ef1c4c8cd2c4ade1642a6f3857ed711a46
Showing with 105 additions and 0 deletions.
  1. +47 −0 bin/v-update-dns-templates
  2. +58 −0 bin/v-update-web-templates
@@ -0,0 +1,47 @@
#!/bin/bash
# info: update dns templates
# options: [RESTART]
#
# The function for obtaining updated pack of dns templates.


#----------------------------------------------------------#
# Variable&Function #
#----------------------------------------------------------#

# Argument defenition
restart=$1

# Includes
source $VESTA/conf/vesta.conf
source $VESTA/func/main.sh


#----------------------------------------------------------#
# Action #
#----------------------------------------------------------#

# Get new archive
tmpdir=$(mktemp -d --dry-run)
mkdir $tmpdir
cd $tmpdir
wget http://c.vestacp.com/0.9.8/rhel/templates.tar.gz -q
if [ "$?" -ne 0 ]; then
echo "Error: can't download template.tar.gz"
log_event "$E_CONNECT" "$EVENT"
rm -rf $tmpdir
exit $E_CONNECT
fi

# Update templates
tar -xzpf templates.tar.gz -C $VESTA/data/ templates/dns


#----------------------------------------------------------#
# Vesta #
#----------------------------------------------------------#

# Clean tmpdir
rm -rf $tmpdir

exit
@@ -0,0 +1,58 @@
#!/bin/bash
# info: updates web templates
# options: [RESTART]
#
# The function for obtaining updated pack of web templates.


#----------------------------------------------------------#
# Variable&Function #
#----------------------------------------------------------#

# Argument defenition
restart=$1

# Includes
source $VESTA/conf/vesta.conf
source $VESTA/func/main.sh


#----------------------------------------------------------#
# Action #
#----------------------------------------------------------#

# Get new archive
tmpdir=$(mktemp -d --dry-run)
mkdir $tmpdir
cd $tmpdir
wget http://c.vestacp.com/0.9.8/rhel/templates.tar.gz -q
if [ "$?" -ne 0 ]; then
echo "Error: can't download template.tar.gz"
log_event "$E_CONNECT" "$EVENT"
rm -rf $tmpdir
exit $E_CONNECT
fi

# Update templates
tar -xzpf templates.tar.gz -C $VESTA/data/ templates/web

# Rebuild web domains
for user in $($BIN/v-list-sys-users plain); do
$BIN/v-rebuild-web-domains $user no
done


#----------------------------------------------------------#
# Vesta #
#----------------------------------------------------------#

# Restart web server
if [ "$restart" != 'no' ]; then
$BIN/v-restart-web
$BIN/v-restart-proxy
fi

# Delete tmpdir
rm -rf $tmpdir

exit

0 comments on commit 349308e

Please sign in to comment.