xen-tools/mdmxen/bin/mdmxen_backuper.sh

62 lines
1.3 KiB
Bash

#!/bin/bash
# mdmxen project - backuper for backup vm with days rotation etc
# version 0-test
# include this host config
. /root/bin/mdmxen/etc/host.cfg
# include libraries for work
. /root/bin/mdmxen/lib/libsys.sh
. /root/bin/mdmxen/lib/librotation.sh
. /root/bin/mdmxen/lib/libxen.sh
#main
putlog "---------- Start $ME ----------"
send_state "starting script"
# lock file test
putlog "test lock file"
locktest_state
# test backup directory
putlog "backup target test"
hddtest
ltest_state "backup target test"
# create lock file
putlog "create lock file"
lockcreate
ltest_state "create lock file"
# clear tmp directory
putlog "clear tmp directory"
cleartmp
ltest_state "clear tmp directory"
# begin backup
putlog "begin backup"
send_state "on backup"
send_state "run before actions"
putlog "run before action"
. /root/bin/mdmxen/etc/before.cfg
send_state "run vms actions"
putlog "run vms action"
. /root/bin/mdmxen/etc/vms.cfg
# rotation
putlog "call rotation function"
# AMOUNT_OF_DAYS
send_state "on rotation"
day_rotation_state 3
send_state "run after actions"
putlog "run after action"
. /root/bin/mdmxen/etc/before.cfg
putlog "delete lock file"
lockdelete
ltest_state "delete .lock file"
putlog "create ok file"
okcreate
ltest_state "create ok file"
send_state "done"
putlog "SUCCESS_BACKUP"
putlog "---------- finish $ME ----------"