Skip to content

Commit aa5971e

Browse files
committed
backup for vesta files and db skeleton
1 parent 19e12d9 commit aa5971e

File tree

1 file changed

+80
-5
lines changed

1 file changed

+80
-5
lines changed

bin/v_backup_sys_user

Lines changed: 80 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,8 @@ if [ -z "$output" ]; then
5353
fi
5454

5555
# Addding vesta version
56-
echo "1.0" >$tmpdir/version
57-
echo "$VERSION" > $tmpdir/vesta
56+
echo "1.0" >$tmpdir/backup_version
57+
echo "$VERSION" > $tmpdir/vesta_version
5858

5959
# WEB domains
6060
if [ ! -z "$WEB_SYSTEM" ] && [ "$WEB_SYSTEM" != 'no' ]; then
@@ -178,14 +178,40 @@ if [ ! -z "$DNS_SYSTEM" ] && [ "$DNS_SYSTEM" != 'no' ]; then
178178
cp $V_USERS/$user/zones/$domain $domain
179179
cp /etc/namedb/$domain.db $domain.db
180180
done
181+
182+
if [ -z "$output" ]; then
183+
echo
184+
fi
181185
fi
182186

183187

184188
# Mail domains
185189
# TBD
186190

187191
# DatbaBases
188-
# TDB
192+
if [ ! -z "$DB_SYSTEM" ] && [ "$DB_SYSTEM" != 'no' ]; then
193+
if [ -z "$output" ]; then
194+
echo "-- DB --"
195+
fi
196+
mkdir $tmpdir/db/
197+
198+
# Parsing unsuspeneded domains
199+
conf="$V_USERS/$user/db.conf"
200+
field='$DB'
201+
search_string='DB='
202+
dbs=$(dom_clear_search)
203+
204+
for db in $dbs; do
205+
if [ -z "$output" ]; then
206+
echo -e "\t$(date +%H:%m:%S) $db"
207+
fi
208+
done
209+
210+
if [ -z "$output" ]; then
211+
echo
212+
fi
213+
214+
fi
189215

190216
# Cron jobs
191217
if [ ! -z "$CRON_SYSTEM" ] && [ "$CRON_SYSTEM" != 'no' ]; then
@@ -195,7 +221,14 @@ if [ ! -z "$CRON_SYSTEM" ] && [ "$CRON_SYSTEM" != 'no' ]; then
195221
mkdir $tmpdir/cron/
196222

197223
# Backingup cron recods
224+
if [ -z "$output" ]; then
225+
echo -e "\t$(date +%H:%m:%S) cron.conf"
226+
fi
198227
cp $V_USERS/$user/cron.conf $tmpdir/cron/
228+
229+
if [ -z "$output" ]; then
230+
echo -e "\t$(date +%H:%m:%S) system cron"
231+
fi
199232
cp /var/spool/cron/$user $tmpdir/cron/
200233

201234
if [ -z "$output" ]; then
@@ -209,9 +242,15 @@ if [ ! -z "$WEB_SSL" ] && [ "$WEB_SSL" != 'no' ]; then
209242
if [ -z "$output" ]; then
210243
echo "-- CERTIFICATES --"
211244
fi
245+
mkdir $tmpdir/cert
212246

213247
# Backingup ssl certificates
214-
cp -r $V_USERS/$user/cert $tmpdir/
248+
for cert in $(ls $V_USERS/$user/cert/); do
249+
if [ -z "$output" ]; then
250+
echo -e "\t$(date +%H:%m:%S) $cert"
251+
fi
252+
cp $V_USERS/$user/cert/$cert $tmpdir/cert/
253+
done
215254

216255
if [ -z "$output" ]; then
217256
echo
@@ -220,8 +259,44 @@ if [ ! -z "$WEB_SSL" ] && [ "$WEB_SSL" != 'no' ]; then
220259
fi
221260

222261
# Vesta
262+
if [ -z "$output" ]; then
263+
echo "-- VESTA --"
264+
fi
265+
mkdir $tmpdir/vesta
266+
267+
# Backingup vesta configs
268+
if [ -z "$output" ]; then
269+
echo -e "\t$(date +%H:%m:%S) user.conf"
270+
fi
271+
cp -r $V_USERS/$user/user.conf $tmpdir/vesta/
272+
273+
if [ -e "$V_USERS/$user/billing.log" ]; then
274+
if [ -z "$output" ]; then
275+
echo -e "\t$(date +%H:%m:%S) billing.log"
276+
fi
277+
cp -r $V_USERS/$user/billing.log $tmpdir/vesta/
278+
fi
279+
280+
if [ -e "$V_USERS/$user/reseller.conf" ]; then
281+
if [ -z "$output" ]; then
282+
echo -e "\t$(date +%H:%m:%S) reseller.conf"
283+
fi
284+
285+
cp -r $V_USERS/$user/reseller.conf $tmpdir/vesta/
286+
fi
287+
288+
if [ -e "$V_USERS/$user/history.log" ]; then
289+
if [ -z "$output" ]; then
290+
echo -e "\t$(date +%H:%m:%S) history.log"
291+
fi
292+
293+
cp -r $V_USERS/$user/history.log $tmpdir/vesta/
294+
fi
295+
296+
if [ -z "$output" ]; then
297+
echo
298+
fi
223299

224-
exit
225300

226301
#----------------------------------------------------------#
227302
# Vesta #

0 commit comments

Comments
 (0)