# Revision history [back]

## Automated sync of my fotos to my digiKam desktop ##

I implemented this service - named Fotosync - on my Jolla1 using this =>"https://blog.simon-dreher.de/jolla-foto-backup.html, Creative Commons BY 3.0 by Simon Dreher as a guideline, with few further tweaks.

• We will build on Jolla a systemd user service
• which waits for a WLAN connection to the digiKam machine
• Then uses ssh
• to push all new made fotos of Jolla onto a COLLECTOR directory on it. Jolla plays the active role, while the digiKam machine has the passive role of collecting the data.
• Communication take place only if Jolla and digiKam use a common WLAN router, inside the home network.
• A dedicated encryption key is used exclusively for the fotosync traffic, blocking other usages of it.
• The original system by Simon Dreher syncs every minute from his Jolla to his Home Server with Seafile (a very interesting Home Cloud).
• I will sync fotos with my centralized Foto Archive, a digiKam Collection.
• A digiKam Collection is a Directory Hierarchy plus some databases ,and digiKam plus KIPI plugins.
• If digiKam then detects new Fotos in his subdirectories, it starts automatically to import and integrate them in its collection/database.
• I can then later in digiKam take further steps on the fotos, like:
• Move/copy them to other places,
• rename them
• tag them
• produce special versions, as: smaller for mailing, very small for thumbnails etc.
• And also: correct errors from Jolla, like camera metadata.

DOING

Preparing Jolla

• Accessing the digiKam host through ssh public key authentication

We assume that we have already ssh access to nemo@Sailfish. This makes working on Jolla with a shell much more comfortable than with the on-board console alone.

We generate on Jolla a ssh key, which will be used solely for the fotosync service. Choose no passphrase.

[nemo@Sailfish ~]$ssh-keygen -t rsa -f /home/nemo/.ssh/fotosync  Generating public/private rsa key pair. For a comfortable working, add the hostname and the identity file to your /home/nemo/.ssh/config/ssh-config (adjusting them to Your case): Host Sailfish HostName Sailfish.<domainname>.de User$username
IdentityFile ~/.ssh/fotosync

• Settting up systemd:

Create a file '/home/nemo/.config/systemd/user/fotosync.path' with following content:

[Unit]
Description=Checks if paths changed or contain new images.

[Path]
PathChanged=%h/Pictures/Camera

[Install]
WantedBy=default.target


Now create the file '/home/nemo/.config/systemd/user/backup.service' containing:

[Unit]
Description=Syncs media files from Jolla to the digiKam Archive on (yourusername)@(yourdigiKammachine) and other gadgets.

[Service]
ExecStart=/home/nemo/bin/fotosync.sh


Create the sync procedure '/home/nemo/bin/fotosync.sh' with:

#!/bin/sh

#   TEST=;ssh nemo@Sailfish ./bin/fotosync.sh #
#

COLLECTOR="/home/<username>/images/$(date +%Y)/COLLECTOR" # ssh <username>@<hostname> mkdir -p$COLLECTOR $LOGDIR; # # Check if we are on wlan if [$(/sbin/ifconfig | grep -o wlan0) ]; then
echo "WLAN used"
# Start syncing using rsync
time /usr/bin/rsync Pictures/Camera/ -vhCErltm gianca@ubu476:"$COLLECTOR"/ else echo "No WLAN" mkdir /tmp/backup.lock if [$? -ne 0 ]; then
echo "Another script is already waiting for WLAN to sync."
exit 0
else
# Wait for WLAN to come back
until [ $(/sbin/ifconfig | grep -o wlan0) ]; do echo "Still no WLAN" sleep 60 done time /usr/bin/rsync Pictures/Camera/ -vhCErltm gianca@ubu476:"$COLLECTOR"/
rm -rf /tmp/backup.lock
fi
fi

exit #


Note that here we extablish where we collect our pictures under digiKam:

On the first usage in the year we create a new subdirectory named <year number="">, like '2017', inside Your collection, with a new dir 'COLLECTOR' inside, where the new pictures get collected.

Preparing the digiKam machine

I cannot do it better nor shorter than Simon Dreher, whom I quote here literally:

"For the SSH connection the server has to know the public key and therefore you have to somehow get '~/.ssh/fotosync.pub' or how you called the SSH keyfile in part one onto your server. There you have to append it to '~/.ssh/authorized_keys'.

cat fotosync.pub >> .ssh/authorized_keys


I recommend that you secure this ssh access since the key file lies on a mobile device and is not protected by a passphrase.

You can add two v to the options of the rsync command in the shell script. Then it's more verbose and shows you which command is executed on the server.

rsync --server -vvlmtErCe.iLs . /mnt/Bilder/Jolla


This command can now pasted into the authorized_keys file before the appended key, on the same line:

command="rsync --server -lmtErCe.iLs . /mnt/Bilder/Jolla",no-agent-forwarding,no-port-forwarding,no-pty,no-user-rc,no-X11-forwarding ssh-rsa AA...


Now this is the only command that can be executed with this SSH key. Note that if you remove the vv from the script you also have to remove them from the authorized_keys file."

Note the text "/Bilder/Jolla", from the German installation of Jolla. You may have to change it for Your needs, after looking on Your installation.

• Start the new systemd service

"Now run the script manually once to test and add fingerprint to known hosts. If everything worked we can now enable our systemd files:

systemctl --user start backup.path
systemctl --user enable backup.path


Now we can take a photo and magically it syncs to your server and all your other devices. Tadaa."

Thanks to Simon Dreher for his page =>"https://blog.simon-dreher.de/jolla-foto-backup.html".

## Automated sync of my fotos to my digiKam desktop ##desktop

I implemented this service - named Fotosync - on my Jolla1 using this =>"https://blog.simon-dreher.de/jolla-foto-backup.html, Creative Commons BY 3.0 by Simon Dreher as a guideline, with few further tweaks.

• We will build on Jolla a systemd user service
• which waits for a WLAN connection to the digiKam machine
• Then uses ssh
• to push all new made fotos of Jolla onto a COLLECTOR directory on it. Jolla plays the active role, while the digiKam machine has the passive role of collecting the data.
• Communication take place only if Jolla and digiKam use a common WLAN router, inside the home network.
• A dedicated encryption key is used exclusively for the fotosync traffic, blocking other usages of it.
• The original system by Simon Dreher syncs every minute from his Jolla to his Home Server with Seafile (a very interesting Home Cloud).
• I will sync fotos with my centralized Foto Archive, a digiKam Collection.
• A digiKam Collection is a Directory Hierarchy plus some databases ,and digiKam plus KIPI plugins.
• If digiKam then detects new Fotos in his subdirectories, it starts automatically to import and integrate them in its collection/database.
• I can then later in digiKam take further steps on the fotos, like:
• Move/copy them to other places,
• rename them
• tag them
• produce special versions, as: smaller for mailing, very small for thumbnails etc.
• And also: correct errors from Jolla, like camera metadata.

DOING

Preparing Jolla

• Accessing the digiKam host through ssh public key authentication

We assume that we have already ssh access to nemo@Sailfish. This makes working on Jolla with a shell much more comfortable than with the on-board console alone.

We generate on Jolla a ssh key, which will be used solely for the fotosync service. Choose no passphrase.

[nemo@Sailfish ~]$ssh-keygen -t rsa -f /home/nemo/.ssh/fotosync  Generating public/private rsa key pair. For a comfortable working, add the hostname and the identity file to your /home/nemo/.ssh/config/ssh-config (adjusting them to Your case): Host Sailfish HostName Sailfish.<domainname>.de Sailfish<.domainname>.de User$username
IdentityFile ~/.ssh/fotosync

• Settting up systemd:

Create a file '/home/nemo/.config/systemd/user/fotosync.path' with following content:

[Unit]
Description=Checks if paths changed or contain new images.

[Path]
PathChanged=%h/Pictures/Camera

[Install]
WantedBy=default.target


Now create the file '/home/nemo/.config/systemd/user/backup.service' containing:

[Unit]
Description=Syncs media files from Jolla to the digiKam Archive on (yourusername)@(yourdigiKammachine) and other gadgets.

[Service]
ExecStart=/home/nemo/bin/fotosync.sh


Create the sync procedure '/home/nemo/bin/fotosync.sh' with:

#!/bin/sh

#   TEST=;ssh nemo@Sailfish ./bin/fotosync.sh #
#

COLLECTOR="/home/<username>/images/$(date +%Y)/COLLECTOR" # ssh <username>@<hostname> <username>@<digiKammachine> mkdir -p$COLLECTOR $LOGDIR; # # Check if we are on wlan if [$(/sbin/ifconfig | grep -o wlan0) ]; then
echo "WLAN used"
# Start syncing using rsync
time /usr/bin/rsync Pictures/Camera/ -vhCErltm gianca@ubu476:"$COLLECTOR"/ <username>@<digiKammachine>:"$COLLECTOR"/
else
echo "No WLAN"
mkdir /tmp/backup.lock
if [ $? -ne 0 ]; then echo "Another script is already waiting for WLAN to sync." exit 0 else # Wait for WLAN to come back until [$(/sbin/ifconfig | grep -o wlan0) ]; do
echo "Still no WLAN"
sleep 60
done
time /usr/bin/rsync Pictures/Camera/ -vhCErltm gianca@ubu476:"$COLLECTOR"/ <username>@<digiKammachine>:"$COLLECTOR"/
rm -rf /tmp/backup.lock
fi
fi

exit #


Note that here we extablish where we collect our pictures under digiKam:

On the first usage in the year we create a new subdirectory named <year number="">, like '2017', inside Your collection, with a new dir 'COLLECTOR' inside, where the new pictures get collected.

Preparing the digiKam machine

I cannot do it better nor shorter than Simon Dreher, whom I quote here literally:

"For the SSH connection the server has to know the public key and therefore you have to somehow get '~/.ssh/fotosync.pub' or how you called the SSH keyfile in part one onto your server. There you have to append it to '~/.ssh/authorized_keys'.

cat fotosync.pub >> .ssh/authorized_keys


I recommend that you secure this ssh access since the key file lies on a mobile device and is not protected by a passphrase.

You can add two v to the options of the rsync command in the shell script. Then it's more verbose and shows you which command is executed on the server.

rsync --server -vvlmtErCe.iLs . /mnt/Bilder/Jolla


This command can now pasted into the authorized_keys file before the appended key, on the same line:

command="rsync --server -lmtErCe.iLs . /mnt/Bilder/Jolla",no-agent-forwarding,no-port-forwarding,no-pty,no-user-rc,no-X11-forwarding ssh-rsa AA...


Now this is the only command that can be executed with this SSH key. Note that if you remove the vv from the script you also have to remove them from the authorized_keys file."

Note the text "/Bilder/Jolla", from the German installation of Jolla. You may have to change it for Your needs, after looking on Your installation.

• Start the new systemd service

"Now run the script manually once to test and add fingerprint to known hosts. If everything worked we can now enable our systemd files:

systemctl --user start backup.path
systemctl --user enable backup.path


Note the "--user" parameter, which avoids using root. The sevice will then not show up with "systemctl", but only with "systemctl --user status fotosync.path".

Now we can take a photo and magically it syncs to your server and all your other devices. Tadaa."

Thanks to Simon Dreher for his page =>"https://blog.simon-dreher.de/jolla-foto-backup.html".

## Automated sync of my fotos to my digiKam desktop

I implemented this service - named Fotosync - on my Jolla1 using this =>"https://blog.simon-dreher.de/jolla-foto-backup.html, Creative Commons BY 3.0 by Simon Dreher as a guideline, with few further tweaks.

• We will build on Jolla a systemd user service
• which waits for a WLAN connection to the digiKam machine
• Then uses ssh
• to push all new made fotos of Jolla onto a COLLECTOR directory on it. Jolla plays the active role, while the digiKam machine has the passive role of collecting the data.
• Communication take place only if Jolla and digiKam use a common WLAN router, inside the home network.
• A dedicated encryption key is used exclusively for the fotosync traffic, blocking other usages of it.
• The original system by Simon Dreher syncs every minute from his Jolla to his Home Server with Seafile (a very interesting Home Cloud).
• I will sync fotos with my centralized Foto Archive, a digiKam Collection.
• A digiKam Collection is a Directory Hierarchy plus some databases ,and digiKam plus KIPI plugins.
• If digiKam then detects new Fotos in his subdirectories, it starts automatically to import and integrate them in its collection/database.
• I can then later in digiKam take further steps on the fotos, like:
• Move/copy them to other places,
• rename them
• tag them
• produce special versions, as: smaller for mailing, very small for thumbnails etc.
• And also: correct errors from Jolla, like camera metadata.

DOING

Preparing Jolla

• Accessing the digiKam host through ssh public key authentication

We assume that we have already ssh access to nemo@Sailfish. This makes working on Jolla with a shell much more comfortable than with the on-board console alone.

We generate on Jolla a ssh key, which will be used solely for the fotosync service. Choose no passphrase.

[nemo@Sailfish ~]$ssh-keygen -t rsa -f /home/nemo/.ssh/fotosync  • Generating public/private rsa key pair. For a comfortable working, add the hostname and the identity file to your /home/nemo/.ssh/config/ssh-config (adjusting them to Your case): Host Sailfish HostName Sailfish<.domainname>.de User$username
IdentityFile ~/.ssh/fotosync

• Settting up systemd:

Create a file '/home/nemo/.config/systemd/user/fotosync.path' with following content:

[Unit]
Description=Checks if paths changed or contain new images.

[Path]
PathChanged=%h/Pictures/Camera

[Install]
WantedBy=default.target


Now create the file '/home/nemo/.config/systemd/user/backup.service' containing:

[Unit]
Description=Syncs media files from Jolla to the digiKam Archive on (yourusername)@(yourdigiKammachine) and other gadgets.

[Service]
ExecStart=/home/nemo/bin/fotosync.sh


Create the sync procedure '/home/nemo/bin/fotosync.sh' with:

#!/bin/sh

#   TEST=;ssh nemo@Sailfish ./bin/fotosync.sh #
#

COLLECTOR="/home/<username>/images/$(date +%Y)/COLLECTOR" # ssh <username>@<digiKammachine> mkdir -p$COLLECTOR $LOGDIR; # # Check if we are on wlan if [$(/sbin/ifconfig | grep -o wlan0) ]; then
echo "WLAN used"
# Start syncing using rsync
time /usr/bin/rsync Pictures/Camera/ -vhCErltm <username>@<digiKammachine>:"$COLLECTOR"/ else echo "No WLAN" mkdir /tmp/backup.lock if [$? -ne 0 ]; then
echo "Another script is already waiting for WLAN to sync."
exit 0
else
# Wait for WLAN to come back
until [ $(/sbin/ifconfig | grep -o wlan0) ]; do echo "Still no WLAN" sleep 60 done time /usr/bin/rsync Pictures/Camera/ -vhCErltm <username>@<digiKammachine>:"$COLLECTOR"/
rm -rf /tmp/backup.lock
fi
fi

exit #


Note that here we extablish where we collect our pictures under digiKam:

On the first usage in the year we create a new subdirectory named <year number="">, like '2017', inside Your collection, with a new dir 'COLLECTOR' inside, where the new pictures get collected.

Preparing the digiKam machine

I cannot do it better nor shorter than Simon Dreher, whom I quote here literally:

"For the SSH connection the server has to know the public key and therefore you have to somehow get '~/.ssh/fotosync.pub' or how you called the SSH keyfile in part one onto your server. There you have to append it to '~/.ssh/authorized_keys'.

cat fotosync.pub >> .ssh/authorized_keys


I recommend that you secure this ssh access since the key file lies on a mobile device and is not protected by a passphrase.

You can add two v to the options of the rsync command in the shell script. Then it's more verbose and shows you which command is executed on the server.

rsync --server -vvlmtErCe.iLs . /mnt/Bilder/Jolla


This command can now pasted into the authorized_keys file before the appended key, on the same line:

command="rsync --server -lmtErCe.iLs . /mnt/Bilder/Jolla",no-agent-forwarding,no-port-forwarding,no-pty,no-user-rc,no-X11-forwarding ssh-rsa AA...


Now this is the only command that can be executed with this SSH key. Note that if you remove the vv from the script you also have to remove them from the authorized_keys file."

Note the text "/Bilder/Jolla", from the German installation of Jolla. You may have to change it for Your needs, after looking on Your installation.

• Start the new systemd service

"Now run the script manually once to test and add fingerprint to known hosts. If everything worked we can now enable our systemd files:

systemctl --user start backup.path
systemctl --user enable backup.path


Note the "--user" parameter, which avoids using root. The sevice will then not show up with "systemctl", but only with "systemctl --user status fotosync.path".

Now we can take a photo and magically it syncs to your server and all your other devices. Tadaa."

Thanks to Simon Dreher for his page =>"https://blog.simon-dreher.de/jolla-foto-backup.html".

## Automated sync of my fotos to my digiKam desktop

I implemented this service - named Fotosync - on my Jolla1 using this =>"https://blog.simon-dreher.de/jolla-foto-backup.html, Creative Commons BY 3.0 by Simon Dreher as a guideline, with few further tweaks.

• We will build on Jolla a systemd user service
• which waits for a WLAN connection to the digiKam machine
• Then machine,
• then uses ssh
• to push all new made fotos of Jolla onto a COLLECTOR directory on it. Jolla plays the active role, while the digiKam machine has the passive role of collecting the data.
• Communication Communications take place only if Jolla and digiKam use a common WLAN router, inside the home network.
• A dedicated encryption key is used exclusively for the fotosync traffic, blocking other usages of it.
• The original system by Simon Dreher syncs every minute from his Jolla to his Home Server with Seafile (a very interesting Home Cloud).
• I will sync fotos with my centralized Foto Archive, a digiKam Collection.
• A digiKam Collection is a Directory Hierarchy plus some databases ,and digiKam plus KIPI plugins.
• If digiKam then detects new Fotos in his subdirectories, it starts automatically to import and integrate them in its collection/database.
• I can then later in digiKam take further steps on the fotos, like:
• Move/copy them to other places,
• rename them
• tag them
• produce special versions, as: smaller for mailing, very small for thumbnails etc.
• And also: correct errors from Jolla, like camera metadata.

DOING

Preparing Jolla

• Accessing the digiKam host through ssh public key authentication

We assume that we have already ssh access to nemo@Sailfish. This makes working on Jolla with a shell much more comfortable than with the on-board console alone.

We generate on Jolla a ssh key, which will be used solely for the fotosync service. Choose no passphrase.

[nemo@Sailfish ~]$ssh-keygen -t rsa -f /home/nemo/.ssh/fotosync  • Generating public/private rsa key pair. For a comfortable working, add the hostname and the identity file to your /home/nemo/.ssh/config/ssh-config (adjusting them to Your case): Host Sailfish HostName Sailfish<.domainname>.de User$username
IdentityFile ~/.ssh/fotosync

• Settting up systemd:

Create a file '/home/nemo/.config/systemd/user/fotosync.path' with following content:

[Unit]
Description=Checks if paths changed or contain new images.

[Path]
PathChanged=%h/Pictures/Camera

[Install]
WantedBy=default.target


Now create the file '/home/nemo/.config/systemd/user/backup.service' containing:

[Unit]
Description=Syncs media files from Jolla to the digiKam Archive on (yourusername)@(yourdigiKammachine) and other gadgets.

[Service]
ExecStart=/home/nemo/bin/fotosync.sh


Create the sync procedure '/home/nemo/bin/fotosync.sh' with:

#!/bin/sh

#   TEST=;ssh nemo@Sailfish ./bin/fotosync.sh #
#

COLLECTOR="/home/<username>/images/$(date +%Y)/COLLECTOR" # ssh <username>@<digiKammachine> mkdir -p$COLLECTOR $LOGDIR; # # Check if we are on wlan if [$(/sbin/ifconfig | grep -o wlan0) ]; then
echo "WLAN used"
# Start syncing using rsync
time /usr/bin/rsync Pictures/Camera/ -vhCErltm <username>@<digiKammachine>:"$COLLECTOR"/ else echo "No WLAN" mkdir /tmp/backup.lock if [$? -ne 0 ]; then
echo "Another script is already waiting for WLAN to sync."
exit 0
else
# Wait for WLAN to come back
until [ $(/sbin/ifconfig | grep -o wlan0) ]; do echo "Still no WLAN" sleep 60 done time /usr/bin/rsync Pictures/Camera/ -vhCErltm <username>@<digiKammachine>:"$COLLECTOR"/
rm -rf /tmp/backup.lock
fi
fi

exit #


Note that here we extablish where we collect our pictures under digiKam:

On the first usage in the year we create a new subdirectory named <year number="">, like '2017', inside Your collection, with a new dir 'COLLECTOR' inside, where the new pictures get collected.

Preparing the digiKam machine

I cannot do it better nor shorter than Simon Dreher, whom I quote here literally:

"For the SSH connection the server has to know the public key and therefore you have to somehow get '~/.ssh/fotosync.pub' or how you called the SSH keyfile in part one onto your server. There you have to append it to '~/.ssh/authorized_keys'.

cat fotosync.pub >> .ssh/authorized_keys


I recommend that you secure this ssh access since the key file lies on a mobile device and is not protected by a passphrase.

You can add two v to the options of the rsync command in the shell script. Then it's more verbose and shows you which command is executed on the server.

rsync --server -vvlmtErCe.iLs . /mnt/Bilder/Jolla


This command can now pasted into the authorized_keys file before the appended key, on the same line:

command="rsync --server -lmtErCe.iLs . /mnt/Bilder/Jolla",no-agent-forwarding,no-port-forwarding,no-pty,no-user-rc,no-X11-forwarding ssh-rsa AA...


Now this is the only command that can be executed with this SSH key. Note that if you remove the vv from the script you also have to remove them from the authorized_keys file."

Note the text "/Bilder/Jolla", from the German installation of Jolla. You may have to change it for Your needs, after looking on Your installation.

• Start the new systemd service

"Now run the script manually once to test and add fingerprint to known hosts. If everything worked we can now enable our systemd files:

systemctl --user start backup.path
systemctl --user enable backup.path


Note the "--user" parameter, which avoids using root. The sevice will then not show up with "systemctl", but only with "systemctl --user status fotosync.path".

Now we can take a photo and magically it syncs to your server and all your other devices. Tadaa."

Thanks to Simon Dreher for his page =>"https://blog.simon-dreher.de/jolla-foto-backup.html".