Setting up Rclone on my Jolla2 to backup my pictures etc. to my Owncloud server.
Even if having used HPUX at work from 1980s I do not have too much experience using shell scripts, services etc. in Linux. In my XperiaX I used GhostCloud and Sailsync, but I did not get it working in my Jolla2. I found some instructions that I tried to follow.
However, it took me some time to understand and manage to get the setting to work. Some options in shell scripts did not work or exist in Sailfish (pidof -x), so I left those checks away. (Below Keto explained why.)
So I think, that as difficult as it was for me, this may be of help for someone new to Sailfish.
There may be better ways to do it, but here is how I did it, it is just a basic setup, and it works for me.
Someone with more knowledge may make it more usable and streamlined.
First I created folder where I softlinked Pictures and Videos folders of Sailfish.
mkdir /home/defaultuser/OC
(OC since I use OwnCloud to backup my files
).
Loaded rclone from
and installed.
Ran config
rclone config
as defaultuser and selected:
e/n/d/r/c/s/q> n (New remote)
name> OC
Storage> 63 (WebDAV)
url> https://myserver.com/owncloud/remote.php/dav/files/heikkiap/
vendor> 3 (Owncloud 10 PHP based WebDAV server)
user> heikkiap
Password> y
Enter the password: “typed my password”
Confirm the password: “typed my password”
bearer_token> “ENTER” to leave empty
Edit advanced config?
y/n> n
Keep this “OC” remote?
y/e/d> y
e/n/d/r/c/s/q> q (selected q to quit)
Now I had rclone.conf file:
/home/defaultuser/.config/rclone/rclone.conf
[owncloud]
type = webdav
url = https://myserver.com/owncloud/remote.php/dav/files/heikkiap/
vendor = owncloud
pass = xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
user = heikkiap
I edited rclone.conf file (had to install nano editor to make editing more convenient), added lines at the beginning, so I had:
[my-files]
type = alias
remote = /home/defaultuser/OC
[owncloud]
type = webdav
url = https://myserver.com/owncloud/remote.php/dav/files/heikkiap/
vendor = owncloud
pass = xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
user = heikkiap
Then created backup script, guided from instructions:
/usr/local/bin/rclone-backup.sh
#!/bin/bash
#if \[\[ “`pidof -x $(basename $0) -o %PPID`” \]\]; then
#echo “rclone-backup.sh is already running”
#exit;
#fi
rclone copy -v --fast-list --transfers 30 “my-files:” “owncloud:” -L
(had to comment lines for script already running, since pidof -x gave error message. (Again, Keto explained why, but left commands visible as they were in the original link of instructions.)
Created file for service, guided from instructions:
/etc/systemd/user/rclone.service (improved by Keto suggestion)
[Unit]
Description=RClone Backup
[Service]
Type=simple
ExecStart=/usr/local/bin/rclone-backup.sh
Created timer file, guided from instructions:
/etc/systemd/user/rclone.timer (improved by Keto suggestion)
[Unit]
Description=RClone Backup Timer
[Timer]
Unit=rclone.service
#Run 15 minutes after boot, since the timer must run at least once
#before OnUnitInactiveSec will trigger
##OnBootSec=15m
#Run 15 minutes after rclone.service last finished
##OnUnitInactiveSec=15m
#Run once when the timer is first started
##OnActiveSec=1s
#Run on calendar, “WallClock”
#Run every day at 3:00 AM
OnCalendar=*-*-* 03:00:00
[Install]
WantedBy=timers.target
Selected to run the backup just every night at 03:00, not sure if “OnBootSec” or “OnInitInactiveSec” are essential, but for me it works like this.
And as instructions guides I ran (not as root, but as user, by Keto improvements in the file locations):
systemctl -–user daemon-reload
systemctl –-user enable rclone.timer
systemctl –-user start rclone.timer
You can check the timer status with:
systemctl –-user status rclone.timer
You can also check the status of the service with:
systemctl -–user status rclone.service
If you want to manually run a backup at any time, just start the service manually:
systemctl --user start rclone.service