Skip to content

Commit

Permalink
Added the call to statistics during backup
Browse files Browse the repository at this point in the history
  • Loading branch information
essepuntato committed Aug 31, 2016
1 parent adabe4e commit 4fc26eb
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 0 deletions.
3 changes: 3 additions & 0 deletions backup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ while ps -ef | grep "[p]ython bee.py" > /dev/null || ps -ef | grep "[p]ython spa
sleep 60
done

# Get last statistics
/home/essepuntato/OC/statistics.sh

cd /srv/oc

# Backup of the OCC
Expand Down
35 changes: 35 additions & 0 deletions script/extract_backup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright (c) 2016, Silvio Peroni <[email protected]>
#
# Permission to use, copy, modify, and/or distribute this software for any purpose
# with or without fee is hereby granted, provided that the above copyright notice
# and this permission notice appear in all copies.
#
# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
# REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
# FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT,
# OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
# DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
# ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
# SOFTWARE.

import sys
import os
import re

done = set()

base_dir = os.path.dirname(sys.argv[0])
for cur_dir, cur_subdir, cur_files in os.walk(base_dir):
for cur_file in cur_files:
if cur_file.endswith(".dar"):
base_name = re.sub("^(.+)\.[0-9]+.dar$", "\\1", cur_file)
if base_name not in done:
done.add(base_name)
final_dir = os.sep.join(re.sub("^[0-9]+-[0-9]+-[0-9]+-", "", base_name).split("_"))
# $BACKUP_DATE-corpus_re_$CUR_DIR
# Be OS indipendent
# TODO: check if dar is removed

# dar -x pippo/my_backup -R /some/where/else

0 comments on commit 4fc26eb

Please sign in to comment.