Skip to main content

Krummstiel

Krummstiel is a small Python script automating regular backup apple ios device. The idea is to incrementally save pictures to your server/desktop. It is in use on Linux, but could be run on macOS as well with the proper tools installed.

Features

Implemented:

  • Automatically mount and copy Files to Backup path via rsync for configured and connected devices.
  • Configuration of backup path
  • Configure excluded paths globally or per Device
  • Help in connecting new devices
  • Silently ignore disconnected devices

Planned Features:

  • Notify user of the backup start and finished on the device
  • Delete old photos and videos from the device after backup. Should understand not to delete Favourites or specified albums. For that the Photos.sqlite database has to be read and understood. My efforts to understand the database are found in photossqlite.md File.
  • Backup application data

Get Started

  1. Install required tools and libraries:
    Linux (Ubuntu 20.4):
    apt install libimobiledevice6 libimobiledevice-utils ifuse rsync 
    
    macOS:
    brew install --cask osxfuse
    brew install libimobiledevice ifuse 
    
  2. Clone this Repository or get krummstiel.py
  3. Create a target directory that will contain the backups e.g. via mkdir /mnt/data/iphone_backups
  4. Create your config file from example.ini
  5. Discover connected devices via
    krummstiel.py --discover --config "/path/to/myconfig.ini"
    
  6. run the script via:
    krummstiel.py --config "/path/to/myconfig.ini" --verbose
    

Config

Configuration is done via .ini File and is passed via --config or -c parameter.

[DEFAULT]

# path fo the backup, the name of the device will always be appended
backup_path = /mnt/data/iphone_backups

# excludes can be an json array or a single value see example of iphone1
# format is for rsync --exclude syntax
exclude = Podcasts

# Section naming will be used for identifying the ios device
# Section is the uid of the ios device
[1234567890abcdef1234567890abcdef12345678]
# name is used to create the folder and copy files
name = my_iphone
# exclude can be repeated and is overriding exclude of the DEFAULT section
# json array
exclude = ["Podcasts", "Books"]

Automating with UDEV (Linux only)

Udev allows you to run scripts when devices are plugged in.

Examples:

Automating with cron

Krummstiel can just run regularly with as a cronjob. Running it with your user ensures that you have access to the files backed up.

*/5 *    * * *   your_user_id    path/to/krummstiel.py --config "path/to/config.ini" >> /path/to/backup.log

Name

The name of the program was chosen to be an Apple that is under threat. One would assume that apples are ubiquitous and are in status "least concern", while this is true for many apples (especially for commercially used and still distributed apples) there are many apple types that are endangered.

The Rheinischer Krummstiel is an old apple variant which is on the "Red list of endagered domestic plants" of the German "Federal Office for Agriculture and Food". It can roughly be translated to "crooked stalk", which I found a good analogy for attaching the Apple device to an usb cable.

There are more apples, that are under threat visit the IUCN Threatened Species list for a full list of all species.

License

Krummstiel uses the MIT License.

Release files for krummstiel 0.0.6

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for krummstiel 0.0.6
File Size Uploaded
krummstiel-0.0.6.tar.gz 6.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for krummstiel 0.0.6
File Interpreter ABI Platform
krummstiel-0.0.6-py3-none-any.whl Python 3 none any Details

Total release size:14.5 kB

Release files / krummstiel-0.0.6.tar.gz

Download URL krummstiel-0.0.6.tar.gz
Size 6.6 kB
Tags Source
SHA-256 checksum
How to use checksums
65bde4ddb99aa117a61db128a8f0879e095e42fecfd6d059f06fd71b95f0785f
BLAKE2b-256 checksum
How to use checksums
0c3358709759f7e145ba48d0506a75acb40be28fb07ae5ec9189d63f6f9bbe68
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/51.3.3 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.9.1

Release files / krummstiel-0.0.6-py3-none-any.whl

Download URL krummstiel-0.0.6-py3-none-any.whl
Size 7.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1b6e0a199a9651595b6bfb86701bacf7e589a682e48518b37da457c46ed2a5f5
BLAKE2b-256 checksum
How to use checksums
d941146e8f26a17e87e6c232425eea7675d5bfbf4792d8c8e29e27e0692b0750
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/51.3.3 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.9.1

Release history Release notifications | RSS feed

This release

0.0.6 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page