alpha 0.1
This commit is contained in:
23
lib/backup.sh
Normal file
23
lib/backup.sh
Normal file
@@ -0,0 +1,23 @@
|
||||
source /opt/server-ultimate/config/main.conf
|
||||
|
||||
backup_create() {
|
||||
local COMP="$1"; shift
|
||||
local FILES="$@"
|
||||
|
||||
TS="$(date +%F_%H-%M-%S)"
|
||||
DEST="$BACKUP_DIR/$COMP/$TS"
|
||||
|
||||
mkdir -p "$DEST"
|
||||
for f in $FILES; do
|
||||
[ -f "$f" ] && cp -a "$f" "$DEST/"
|
||||
done
|
||||
|
||||
echo "$DEST"
|
||||
}
|
||||
|
||||
backup_restore() {
|
||||
local COMP="$1"
|
||||
ls "$BACKUP_DIR/$COMP"
|
||||
read -p "Snapshot: " TS
|
||||
cp -av "$BACKUP_DIR/$COMP/$TS"/* /
|
||||
}
|
||||
Reference in New Issue
Block a user