A
A
Adept Popken2014-10-07 16:22:28
Yandex.Disk
Adept Popken, 2014-10-07 16:22:28

Console Yandex.Disk - how to autostart the Yandex.Disk daemon on Debian?

There is a server on Debian. There is a well-installed and well-functioning Yandex console disk. However, there is one "BUT" - the daemon does not start after the system reboot, although this feature was set when installing the disk. Manually, with the usual yandex-disk start command, everything works without any problems.
Wrote the simplest daemon startup script, called it yandex_autorun.sh

#!/bin/sh
yandex-disk start

Then chmod +x on it. And checked with handles (sh yandex_autorun.sh) - with handles, the script starts Yandex without problems.
I draw your attention to the fact that the command / script is run only from under the user ( adept ). Under the root gives out some kind of crap.
Methods used:
1. Putting the sh script in the /etc/network/if-up.d/ folder did not help
2. Setting the path to the script in /etc/network/interfaces did not help
3. Put such a thing into the crontab as advised in a similar question Ilya Maltsev :
@reboot adept sleep 60 && /home/adept/yandex_autorun.sh

Nothing started either.
4. I tried to write to rc.local before exit 0. It's also of little use.
In init.d, I failed to create a script.
I will be glad to advice. As a matter of fact that 1 command to launch and all.

Answer the question

In order to leave comments, you need to log in

5 answer(s)
A
Adept Popken, 2014-10-08
@adept7771

Taki managed to solve the loss of little blood. Thanks to @bk0011m for helping me find the answer!
We put the Yandex console disk and make an autorun script.
So - the content of the yandex_autostart.sh script is trivial:

#!/bin/sh
yandex-disk start --dir=/home/adept/srv_storage/YandexDisc --auth=/home/adept/.config/yandex-disk/passwd

start --dir the path where the disk downloads files
--auth the path where the token generated after the installation with your passwords / logins lies
Next, we stomp into the cron crontab -e (without sudo!)
Don't forget also chmod +x путь_до_скрипта(make it executable)
After reboot, cron will wait 60 seconds and kick your script by running the disk.
Mission Compliment!
Cron errors are dumped into the server's internal mail, which I can easily see on Debian with the mail command, case number.

A
Andrew, 2015-02-27
@AndreiLED

Hmm, I don’t understand why it’s so hard to complicate your life with cron if the init.d script is written in 5-20 minutes depending on the skills: either copy-paste one of the available scripts, or follow the guides once and twice .
For example, my /etc/init.d/yadisk

#!/bin/sh -e
### BEGIN INIT INFO
# Provides:          yandex_disk
# Required-Start:    $local_fs
# Required-Stop:     $local_fs
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: Manage Yandex.Disk deamon
### END INIT INFO

# Various constants
user=yadisk

execute() {
    su -c "$1" "$user"
}

start() {
    echo "Starting Yandex.Disk daemon..."
    execute "yandex-disk start"
}

stop() {
    echo "Stopping Yandex.Disk daemon..."
    execute "yandex-disk stop"
}

status() {
    execute "yandex-disk status"
}

# Carry out specific functions when asked to by the system
case "$1" in
  start)
    start
    ;;
  stop)
    stop
    ;;
  status)
    status
    ;;
  restart)
    stop
    start
    ;;
  *)
    echo "Usage: $0 {start|stop|status|restart}"
    exit 1
    ;;
esac

exit 0

The main thing is not to forget after that to perform
update-rc.d yadisk defaults

S
Sergey, 2014-10-07
@bk0011m

What if you don't run it as root? Or is it essential?
The fact is that this software, when synchronized, begins to godlessly eat resources and it’s not at all good if this happens under the root.
And about your problem, I suspect that you need to specify the authorization file, which is also a token. Rather, the path to it

J
JlEB-8, 2015-03-03
@JlEB-8

Even easier, do this:
# chmod +x /etc/rc.d/rc.local
# echo "/usr/bin/yandex-disk start" >> /etc/rc.d/rc.local

K
Kren_vpravo, 2018-09-22
@Kren_vpravo

Or it can be even simpler - if the machine has a graphical interface, then in the menu -> system settings there will be something about autorun, where without understanding anything at all, you can add an application with the mouse, specify the command (yandex-disk start) and even a delay for launch after system startup (or rather login under this user).

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question