📜 ⬆️ ⬇️

Autorun Yandex.Disk as systemd service in Fedora 19

I wanted to make backups on Yandex.Disk. My operating system is Russian Fedora 19 x64. The launch via rc.local was removed from previous releases of Fedora as outdated, and I decided to do everything in my mind — run Yandex.Disk as a system service. The standard launch of services in Fedora 19 is systemd, we are starting to move in this direction. I use the official console client of Yandex.Disk (yes, the code is closed, but it works much faster than webdav, and you don’t have to wrestle with synchronization).

So let's get started:

Everything works after a reboot.

I back up local copies of backups with a local copy of Yandex.Disk by a team in crobtabʻe
 /usr/bin/rsync -rc --delete /mnt/500gb/backups/ /mnt/yandex-disk/backups/ 


Also found the ability to run multiple copies of Yandex.Disk with different accounts. For example:
 /usr/bin/yandex-disk start -c /etc/yandex-disk1/config.cfg /usr/bin/yandex-disk start -c /etc/yandex-disk2/config.cfg /usr/bin/yandex-disk start -c /etc/yandex-disk3/config.cfg 

')
When debugging, I encountered a problem: the service did not start at boot. Issued an error: "Error: the path to the folder is used by another user." But then without any errors, the systemctl start yandex-disk.service was started manually.
It was solved with a crutch with RestartSec = 60 and Restart = always. But I think this is not entirely correct, because the service starts 2 times - what the log section says:
 tail -1000 /var/log/messages | grep 'yandex' Nov 8 19:34:19 sharov yandex-disk[514]: :      : /mnt/yandex-disk Nov 8 19:34:48 sharov systemd[1]: yandex-disk.service holdoff time over, scheduling restart. Nov 8 19:34:49 sharov yandex-disk[1816]:  ... 


PS: My decision does not claim absolute correctness. But it works.
PPS: Something tells me that the Yandex.Disk cart will not allow it to be used normally for backups, since when deleting files from a local copy of Yandex.Disk, they are moved to the basket, and the basket cannot be empty from the console client, only from the web interface. This reduces the size of the disk to the size of the files in the basket. And when it is full, the backups will no longer be copied to it. Or manually press a button to empty the basket from the web interface, which is a crutch. I'll wait until Yandex.Disk is full and see what happens.

Source: https://habr.com/ru/post/201688/


All Articles