68 lines
1.5 KiB
Bash
Executable File
68 lines
1.5 KiB
Bash
Executable File
#!/bin/bash
|
|
# mdmxen project - backuper for backup vm with days rotation etc
|
|
# author mikedmorto 2021 year
|
|
VERSION="1.3"
|
|
|
|
# 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 v$VERSION"
|
|
|
|
# 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"
|
|
|
|
# this is for move tmp do days, because of cannot move empty dir
|
|
touch $DAYS_DIR/null.txt
|
|
|
|
. /root/bin/mdmxen/etc/vms.cfg
|
|
|
|
# rotation
|
|
putlog "call rotation function"
|
|
# AMOUNT_OF_DAYS
|
|
send_state "on rotation"
|
|
day_rotation_state $DAY_ROTATION
|
|
|
|
send_state "run after actions"
|
|
putlog "run after action"
|
|
. /root/bin/mdmxen/etc/after.cfg
|
|
|
|
putlog "delete lock file"
|
|
lockdelete
|
|
ltest_state "delete .lock file"
|
|
putlog "create ok file"
|
|
okcreate
|
|
ltest_state "create ok file"
|
|
send_state "done"
|
|
send_state "stop script v$VERSION"
|
|
putlog "SUCCESS_BACKUP"
|
|
putlog "---------- finish $ME ----------"
|