0

So to be precise I'm trying to delay the startup of "deluge-daemon" on my raspberry pi 2. Somehow the USB (NTFS) only gets automounted (I am using the default automount in Raspbian) after the X-server startup (although I wouldn't even really need the X-server) and Deluge seems to start somewhat earlier than the USB gets mounted and I get the permission problem, because the USB is not mounted yet and have to restart Deluge for it to start to work properly...

So I tried lowering the priority and running it only on runlevel 5:

sudo update-rc.d deluge-daemon start 20 5 . stop 80 0 1 6 .

It doesn't really help. I tried editing the deluge-daemon startup script and adding a

sleep 1m

in the start case of the startup script. It works then and gets mounted after the USB is already mounted, but the problem is that it now slows down every time I try to start the deluge-daemon service, so every time it takes a minute after I decided to stop and start the process manually...

Any help would be appreciated. There has got to be a way to delay the bootup without affecting the general start script...

2

You could check if the USB is mounted before sleeping. For example:

mount | grep -q /path/to/USB/stick/mountpoint || sleep 1m

That sleeps for 1 minute only if the USB stick is not mounted.

  • Hmm, looks like charm in my case. Thanks. Hmm, seems I can't really delay with update rc to work as good as with this. – Arturas M Oct 9 '15 at 22:58
2

When you say:

So I tried lowering the priority and running it only on runlevel 5

I hope you did not lower the start number... because that does the opposite!

The lower the number, the earlier the service will start: rc will run sequentially the contents of /etc/rcS.d/ and then the contents of /etc/rc?.d, being ? the current runlevel, and the contents of the /etc/rc* folders are symlinks to the initscripts of services with the format S??service_name for start scripts (which rc will execute with "start" argument) or K??service_name for stop scripts (which rc will execute with "stop" argument).

In both S?? and K??, the ?? is the position in which it will be executed, being 00 the very first and 99 the very last. When two or more scripts have the same number, then they execute according to alphabetical order of the service name.

With that said, if you run

sudo uptate-rc.d deluge-daemon start 99 5 . stop 80 0 1 6 .

or rename the rc symlink /etc/rc5.d/S??deluge-daemon to /etc/rc5.d/S99deluge-daemon, deluxe-daemon would be the last (or among the very last) service to start in runlevel 5. If you rename the symlink to S99Zdeluge-daemon you have even more possibilities to have it running the last when booting up.

You can of course use this procedure to try to get the services that you need for this deluge-daemon started earlier, if possible.

  • Hmm, somehow it still get's the deluge with S01 despite putting 'start 99 5 .'. What's wierd it also created deluge with S01 in rc2 rc3 and rc4... Maybe i'll try renaming it manually – Arturas M Oct 9 '15 at 22:25
  • Check also service dependencies. We don't want that something that expects deluge-daemon to be there is starting way too early now ;) Tread carefully when altering booting orders – dave_alcarin Oct 9 '15 at 22:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.