Package: owncloud_backup
ownCloud backupThis project is used for uploading the backups to the ownCloud and managing old backups.How it worksBy default, script expects onefileargument, which will be uploaded to ownCloud with%Y.%m.%d_time prefix intoremote_pathdirectory.When the file is uploaded, scripts requests listing of all other files in selectedremote_path, then reads time informations from names and then removes old files.Process of removing of old files is defined to keep following files:all files from last monthone file per week for two-months-beforeone file per two weeks for three-months-beforeand to remove all older files.ConfigurationThere is possibility of configuration of following variables usingconffilesowncloud_backup.cfgor~/.owncloud_backup.cfg:[Login]
user=login@owncloud.tld
pass=password
url=https://owncloud.cesnet.cz

[Config]
remote_path=/backups
no_timestamp=falseAll values inConfigsection andurlvariable fromLoginsection is optional (defaults are shown in this example).no_timestampwill instruct the script to stop putting the timestamp prefix to uploaded files. In that case, it is expected that such files will contain the timestamp added manually, or they will be ignored in process of elimination of old files.Commandline argumentsAll variables defined in configuration file may be also added using commandline arguments:usage: owncloud_backup.py [-h] [-u USERNAME] [-p PASSWORD] [--url URL]
                          [-r REMOTE_PATH] [-n]
                          FILENAME

This program may be used to perform database backups into ownCloud.
Configuration file in ini format is expected in `owncloud_backup.cfg` or
`~/.owncloud_backup.cfg` paths.

positional arguments:
  FILENAME              Upload FILENAME into the ownCloud.

optional arguments:
  -h, --help            show this help message and exit
  -u USERNAME, --username USERNAME
                        Username of the ownCloud user.
  -p PASSWORD, --password PASSWORD
                        Password of the ownCloud user.
  --url URL             URL of the ownCloud service. Default
                        `https://owncloud.cesnet.cz`.
  -r REMOTE_PATH, --remote-path REMOTE_PATH
                        Path on the server. Default `/backups`.
  -n, --no-timestamp    By default, the script adds `%Y.%m.%d_` prefix to each
                        uploaded file.InstallationModule is hosted atPYPI, and
can be installed usingPIP:sudo pip install owncloud_backupInstallation on SuSeIn case that you are using ancient Suse installation with old python versions and no PIP, you may install it with following commands:wget --no-check-certificate https://pypi.python.org/packages/source/s/setuptools/setuptools-20.0.zip
unzip setuptools-20.0.zip
cd setuptools-20.0/
python setup.py install
easy_install pip==1.2
pip install -U owncloud_backupSource codeProject is released under the MIT license. Source code can be found at GitHub:https://github.com/NLCR/owncloud_backupUnittestsAlmost every feature of the project is tested by unittests. You can run those
tests using providedrun_tests.shscript, which can be found in the root
of the project.If you have any trouble, just add--pdbswitch at the end of yourrun_tests.shcommand like this:./run_tests.sh--pdb. This will drop you toPDBshell.RequirementsThis script expects that packagespytestis installed. In case you don’t have it yet, it can be easily installed using following command:pip install --user pytestor for all users:sudo pip install pytestExample./run_tests.sh
============================= test session starts ==============================
platform linux2 -- Python 2.7.6, pytest-2.8.2, py-1.4.30, pluggy-0.3.1
rootdir: /home/bystrousak/Plocha/Dropbox/c0d3z/prace/owncloud_backup, inifile:
plugins: cov-1.8.1
collected 3 items

tests/test_backup.py ...

=========================== 3 passed in 0.47 seconds ===========================Changelog0.1.6Fixed bug in removing old files on remote server.0.1.5Added mute of the InsecurePlatformWarning.0.1.4Fixed bugs in argument parsing priority.0.1.3Added few other python2.6 updates.0.1.2Removed set comprehension to support python2.6.0.1.1Added scripts declaration into setup.py.0.1.0Project created.