From 349308ef1c4c8cd2c4ade1642a6f3857ed711a46 Mon Sep 17 00:00:00 2001 From: Serghey Rodin Date: Tue, 11 Jun 2013 13:47:50 +0300 Subject: [PATCH] update vesta templates --- bin/v-update-dns-templates | 47 ++++++++++++++++++++++++++++++ bin/v-update-web-templates | 58 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 105 insertions(+) create mode 100755 bin/v-update-dns-templates create mode 100755 bin/v-update-web-templates diff --git a/bin/v-update-dns-templates b/bin/v-update-dns-templates new file mode 100755 index 000000000..32e227cdc --- /dev/null +++ b/bin/v-update-dns-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 diff --git a/bin/v-update-web-templates b/bin/v-update-web-templates new file mode 100755 index 000000000..57c8ef3b9 --- /dev/null +++ b/bin/v-update-web-templates @@ -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