su
mkdir /mnt/yandex-disk
cd /usr/src
wget http://repo.yandex.ru/yandex-disk/yandex-disk-latest.x86_64.rpm
rpm -ivh yandex-disk-latest.x86_64.rpm
yandex-disk setup
-? [y/N]: N , https://passport.yandex.ru/passport?mode=register : username : ******* /root/.config/yandex-disk/passwd . . ( '/root/Yandex.Disk'): /mnt/yandex-disk . ? [Y/n]: n
cp -r /root/.config/yandex-disk /etc
nano /etc/yandex-disk/config.cfg
auth="/etc/yandex-disk/passwd" dir="/mnt/yandex-disk"
nano /usr/lib/systemd/system/yandex-disk.service
[Unit] Description=Yandex Disk console client Requires=network.target [Service] Type=forking User=root Group=root ExecStart=/usr/bin/yandex-disk start -c /etc/yandex-disk/config.cfg # , .. , : ": ". # - "Requires=", - , # RestartSec=60 Restart=always [Install] WantedBy=multi-user.target
systemctl --system daemon-reload
systemctl start yandex-disk.service
systemctl status yandex-disk.service
[root@localhost .config]# systemctl status yandex-disk.service yandex-disk.service - Yandex Disk console client Loaded: loaded (/usr/lib/systemd/system/yandex-disk.service; disabled) Active: active (running) since 2013-11-08 23:11:15 MSK; 1s ago Process: 31601 ExecStart=/usr/bin/yandex-disk start -c /etc/yandex-disk/config.cfg (code=exited, status=0/SUCCESS) Main PID: 31638 (yandex-disk) CGroup: name=systemd:/system/yandex-disk.service └─31638 /usr/bin/yandex-disk --tag="1 7 8 9 15 16" --no-daemon="true" --dir="/mnt/yandex-disk" --config="/etc/yandex-disk/config.cfg" --... 08 23:11:15 localhost.localdomain systemd[1]: Started Yandex Disk console client.
yandex-disk status -c /etc/yandex-disk/config.cfg
[root@localhost ~]# yandex-disk status -c /etc/yandex-disk/config.cfg : 47.1 KB/ 3.3 GB (0 %) : .: '/mnt/yandex-disk' : : 5.2 GB : 4.8 GB : 10 GB : 1.9 GB : : 'TEST/testfile.txt'
systemctl enable yandex-disk.service
/usr/bin/rsync -rc --delete /mnt/500gb/backups/ /mnt/yandex-disk/backups/
/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
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]: ...
Source: https://habr.com/ru/post/201688/
All Articles